当前位置: 首页>>代码示例>>C#>>正文


C# dataAccess.sqlGetSingleDouble方法代码示例

本文整理汇总了C#中dataAccess.sqlGetSingleDouble方法的典型用法代码示例。如果您正苦于以下问题:C# dataAccess.sqlGetSingleDouble方法的具体用法?C# dataAccess.sqlGetSingleDouble怎么用?C# dataAccess.sqlGetSingleDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dataAccess的用法示例。


在下文中一共展示了dataAccess.sqlGetSingleDouble方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CopyTask

        private string CopyTask(int iMode, string sSourceTaskID, string sNewTaskName, string sNewTaskCode)
        {
            //iMode 0=new task, 1=new major version, 2=new minor version
            dataAccess dc = new dataAccess();
            acUI.acUI ui = new acUI.acUI();

            string sErr = "";
            string sSQL = "";

            string sNewTaskID = ui.NewGUID();

            int iIsDefault = 0;
            string sTaskName = "";
            double dVersion = 1.000;
            double dMaxVer = 0.000;
            string sOTID = "";

            //do it all in a transaction
            dataAccess.acTransaction oTrans = new dataAccess.acTransaction(ref sErr);

            //figure out the new name and selected version
            oTrans.Command.CommandText = "select task_name, version, original_task_id from task where task_id = '" + sSourceTaskID + "'";
            DataRow dr = null;
            if (!oTrans.ExecGetDataRow(ref dr, ref sErr))
                throw new Exception("Unable to find task for ID [" + sSourceTaskID + "]." + sErr);

            sTaskName = dr["task_name"].ToString();
            dVersion = Convert.ToDouble(dr["version"]);
            sOTID = dr["original_task_id"].ToString();

            //figure out the new version
            switch (iMode)
            {
                case 0:
                    sTaskName = sNewTaskName;
                    iIsDefault = 1;
                    dVersion = 1.000;
                    sOTID = sNewTaskID;

                    break;
                case 1:
                    //gotta get the highest version
                    sSQL = "select max(version) from task where task_id = '" + sOTID + "'";
                    dc.sqlGetSingleDouble(ref dMaxVer, sSQL, ref sErr);
                    if (sErr != "")
                    {
                        oTrans.RollBack();
                        throw new Exception(sErr);
                    }

                    dVersion = dMaxVer + 1;

                    break;
                case 2:
                    sSQL = "select max(version) from task where task_id = '" + sOTID + "'" +
                        " and cast(version as unsigned) = " + Convert.ToInt32(dVersion);
                    dc.sqlGetSingleDouble(ref dMaxVer, sSQL, ref sErr);
                    if (sErr != "")
                    {
                        oTrans.RollBack();
                        throw new Exception(sErr);
                    }

                    dVersion = dMaxVer + 0.001;

                    break;
                default: //a iMode is required
                    throw new Exception("A mode required for this copy operation." + sErr);
            }

            //if we are versioning, AND there are not yet any 'Approved' versions,
            //we set this new version to be the default
            //(that way it's the one that you get taken to when you pick it from a list)
            if (iMode > 0)
            {
                sSQL = "select case when count(*) = 0 then 1 else 0 end" +
                    " from task where original_task_id = '" + sOTID + "'" +
                    " and task_status = 'Approved'";
                dc.sqlGetSingleInteger(ref iIsDefault, sSQL, ref sErr);
                if (sErr != "")
                {
                    oTrans.RollBack();
                    throw new Exception(sErr);
                }
            }

            //start copying
            oTrans.Command.CommandText = "create temporary table _copy_task" +
                " select * from task where task_id = '" + sSourceTaskID + "'";
            if (!oTrans.ExecUpdate(ref sErr))
                throw new Exception(sErr);

            //update the task_id
            oTrans.Command.CommandText = "update _copy_task set" +
                " task_id = '" + sNewTaskID + "'," +
                " original_task_id = '" + sOTID + "'," +
                " version = '" + dVersion + "'," +
                " task_name = '" + sTaskName + "'," +
                " default_version = " + iIsDefault.ToString() + "," +
                " task_status = 'Development'," +
//.........这里部分代码省略.........
开发者ID:remotesyssupport,项目名称:cato,代码行数:101,代码来源:taskMethods.asmx.cs


注:本文中的dataAccess.sqlGetSingleDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。