Exemplo n.º 1
0
        public static int InsertUserAptitude(UserAptitude Uap, byte[] fileByte, ref string a_strErr)
        {
            int intInsert = 0;

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@fileByte", fileByte)
            };
            SQLTrans sqlTrans = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            //string strInsert = GSqlSentence.GetInsertInfoByD<UserAptitude>(Uaptitude, "tk_UserAptitude");
            string strInsert = "insert into tk_UserAptitude (UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName,"
                               + "CertificateUnit,LastCertificatDate,CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate) values ("
                               + "'" + Uap.StrUserID + "','" + Uap.StrUserName + "','" + Uap.StrBusinessType + "','" + Uap.StrTecoName + "','" + Uap.StrTecoClass + "','" + Uap.StrGetTime + "',"
                               + "'" + Uap.StrCertificatCode + "','" + Uap.StrCertificateName + "','" + Uap.StrCertificateUnit + "','" + Uap.StrLastCertificatDate + "','" + Uap.StrCertificatDate + "',"
                               + "'" + Uap.StrFileName + "',@fileByte,'" + Uap.StrRemark + "','" + Uap.StrUnit + "','" + Uap.StrState + "','" + Uap.StrCreateTime + "','" + Uap.StrCreateUser + "','" + Uap.StrValidate + "')";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, para);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 2
0
        public static int UpdateLendAptitude(UCertificatLend Lend, ref string a_strErr)
        {
            int      intInsert = 0;
            int      intupdate = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");

            string strInsert = "update tk_UCertificatLend set ReturnDate = '" + Lend.StrReturnDate + "' where ID = '" + Lend.StrID + "'";
            string strUpdate = "update tk_UserAptitude set State = '0' where ID = '" + Lend.StrID + "'";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                if (strUpdate != "")
                {
                    intupdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert + intupdate);
        }
Exemplo n.º 3
0
        public static int DeleteContent(string xid, string type, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("MainProject");

            string strInsertOrder = "update tk_ConfigContent set Validate = 'i' where XID = '" + xid + "' and Type = '" + type + "'";

            try
            {
                if (strInsertOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null);
                }

                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 4
0
        public static int deleteFile(string id, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsert = "update tk_UserAptitude set FileName = NULL,FileInfo = NULL where ID = '" + id + "'";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 5
0
        public static int InsertRativeSource(RativeSource Rsource, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsert = GSqlSentence.GetInsertInfoByD <RativeSource>(Rsource, "tk_RativeSource");

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 6
0
        public static int UpdateDeviceBas(DevicsBas Bas, string ecode, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsert = "update tk_DevicsBas set ControlCode = '" + Bas.StrControlCode + "',Ename = '" + Bas.StrEname + "',Manufacturer = '" + Bas.StrManufacturer + "',"
                               + "FactoryNumber = '" + Bas.StrFactoryNumber + "',Specification = '" + Bas.StrSpecification + "',DevicsType = '" + Bas.StrDevicsType + "',"
                               + "FactoryDate = '" + Bas.StrFactoryDate + "',TracingType = '" + Bas.StrTracingType + "',Precision = '" + Bas.StrPrecision + "',"
                               + "Clrange = '" + Bas.StrClrange + "',CycleType = '" + Bas.StrCycleType + "',Cycle = '" + Bas.StrCycle + "',"
                               + "CheckCompany = '" + Bas.StrCheckCompany + "',Remark = '" + Bas.StrRemark + "'"
                               + " where ECode = '" + ecode + "'";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 7
0
        public static int UpdateRativeSource(RativeSource Rsource, string id, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsert = "update tk_RativeSource set RID = '" + Rsource.StrRID + "',EquipID = '" + Rsource.StrEquipID + "',ProModel = '" + Rsource.StrProModel + "',"
                               + "Source = '" + Rsource.StrSource + "',Manufacturer = '" + Rsource.StrManufacturer + "',Nominal = '" + Rsource.StrNominal + "',SourceNumber = '" + Rsource.StrSourceNumber + "' where ID = '" + id + "'";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 8
0
        // 确认修改
        public static int ModifyBasic(string XID, string Type, string Text, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("FlowMeterDBCnn");

            string strInsertOrder = "update tk_ConfigContent ";

            strInsertOrder += " set Text = '" + Text + "' where XID = '" + XID + "' and Type = '" + Type + "' and validate='v' ";
            try
            {
                if (strInsertOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null);
                }

                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 9
0
        public static int DeleteRative(string id, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsert = "update tk_RativeSource set Validate = 'i' where ID = '" + id + "'";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 10
0
        // 确认修改 小组人员
        public static int ModifyGroupUser(string UserID, string Text, string GroupID, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("AccountCnn");

            string strInsertOrder = "update UM_Person ";

            strInsertOrder += " set UserName = '******' where GroupID = '" + GroupID + "' and UserID='" + UserID + "' and Validate='v' ";
            try
            {
                if (strInsertOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null);
                }

                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 11
0
        // 删除小组人员
        public static int DeleteGroupUser(string uid, string gid, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("AccountCnn");

            string strUpdateOrder = "update UM_Person set Validate = 'i' ";

            strUpdateOrder += " where GroupID = '" + gid + "' and UserID='" + uid + "' and validate='v' ";
            try
            {
                if (strUpdateOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strUpdateOrder, CommandType.Text, null);
                }

                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 12
0
        public static int UpdateDRepairInfo(DRepairInfo Repair, ref string a_strErr)
        {
            int      intInsert = 0;
            int      intUpdate = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsert = "update tk_DRepairInfo set ServiceRecord = '" + Repair.StrServiceRecord + "',ServiceResults = '" + Repair.StrServiceResults + "',ReturnTime = '" + Repair.StrReturnTime + "',Remark = '" + Repair.StrRemark + "' where ECode = '" + Repair.StrECode + "'";
            string strUpdate = "update tk_DevicsBas set state = '0' where ECode = '" + Repair.StrECode + "'";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                if (strUpdate != "")
                {
                    intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert + intUpdate);
        }
Exemplo n.º 13
0
        public static int InsertDScrapInfo(DScrapInfo Scrap, ref string a_strErr)
        {
            int      intInsert = 0;
            int      intUpdate = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsert = GSqlSentence.GetInsertInfoByD <DScrapInfo>(Scrap, "tk_DScrapInfo");
            string strUpdate = "update tk_DevicsBas set state = '-1' where ECode = '" + Scrap.StrECode + "'";

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                if (strUpdate != "")
                {
                    intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert + intUpdate);
        }
Exemplo n.º 14
0
        public static UIDataTable LoadRepalceAnaly(string where)
        {
            ArrayList Repalce = new ArrayList();

            Repalce.Add("机芯总成"); Repalce.Add("磁耦合"); Repalce.Add("主轴轴承");
            Repalce.Add("叶轮"); Repalce.Add("油泵"); Repalce.Add("机械表头");
            Repalce.Add("前导流"); Repalce.Add("高频头");
            SQLTrans sqlTrans = new SQLTrans();

            sqlTrans.Open("FlowMeterDBCnn");
            UIDataTable instData = new UIDataTable();
            DataTable   dt       = new DataTable();

            dt.Columns.Add("零件", typeof(System.String));
            dt.Columns.Add("问题数量", typeof(System.String));
            dt.Columns.Add("所占比例", typeof(System.String));

            string sqlnum = "select Count(*) from tk_RepairDevice where DeviceName in ('机芯总成','磁耦合','主轴轴承','叶轮','油泵','机械表头','前导流','高频头')";
            var    num    = SQLBase.FillTable(sqlnum, "FlowMeterDBCnn").Rows[0][0];

            for (int i = 0; i < Repalce.Count; i++)
            {
                string rid = "";

                if (where != "")
                {
                    rid = "and  RID in (select RID from tk_RepairCard where 1=1" + where + ")";
                }
                string    sql      = "select Count(*) '数量' from tk_RepairDevice where DeviceName='" + Repalce[i] + "'" + rid;
                DataTable DO_Order = SQLBase.FillTable(sql, "FlowMeterDBCnn");
                for (int j = 0; j < DO_Order.Rows.Count; j++)
                {
                    DataRow newRow = dt.NewRow();
                    newRow["零件"]   = Repalce[i];
                    newRow["问题数量"] = DO_Order.Rows[0]["数量"];
                    if (num.ToString() != "0")
                    {
                        var s = 0.00;
                        if (DO_Order.Rows[0]["数量"].ToString() == "0")
                        {
                            newRow["所占比例"] = "0.00%";
                        }
                        else
                        {
                            s = Convert.ToDouble(DO_Order.Rows[0]["数量"]) / Convert.ToDouble(num.ToString()) * 100;
                            newRow["所占比例"] = Math.Round(s, 2).ToString() + "%";
                        }
                    }
                    else
                    {
                        newRow["所占比例"] = "0.00%";
                    }
                    dt.Rows.Add(newRow);
                }
            }

            instData.DtData = dt;
            return(instData);
        }
Exemplo n.º 15
0
        public static int UpdateUserAptitude(string ID, UserAptitude Uap, byte[] fileByte, ref string a_strErr)
        {
            int intInsert    = 0;
            int intUpdate    = 0;
            int intInsertHis = 0;

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@fileByte", fileByte)
            };
            SQLTrans sqlTrans = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsertHis = "insert into tk_UserAptitudeHis (UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName,CertificateUnit,"
                                  + "LastCertificatDate,CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate"
                                  + ") select UserID,UserName,BusinessType,TecoName,TecoClass,GetTime,CertificatCode,CertificateName,CertificateUnit,LastCertificatDate,"
                                  + "CertificatDate,FileName,FileInfo,Remark,Unit,State,CreateTime,CreateUser,Validate from tk_UserAptitude where ID = '" + ID + "'";

            string strInsert = "update tk_UserAptitude set BusinessType = '" + Uap.StrBusinessType + "',TecoName = '" + Uap.StrTecoName + "',TecoClass = '" + Uap.StrTecoClass + "',"
                               + "GetTime = '" + Uap.StrGetTime + "',CertificatCode = '" + Uap.StrCertificatCode + "',CertificateName = '" + Uap.StrCertificateName + "',CertificateUnit = '" + Uap.StrCertificateUnit + "',"
                               + "LastCertificatDate = '" + Uap.StrLastCertificatDate + "',CertificatDate = '" + Uap.StrCertificatDate + "',Remark = '" + Uap.StrRemark + "' where ID = '" + ID + "'";

            string strUpdate = "";

            if (Uap.StrFileName != null)
            {
                strUpdate = "update tk_UserAptitude set FileName = '" + Uap.StrFileName + "',FileInfo = @fileByte where ID = '" + ID + "'";
            }

            try
            {
                if (strInsertHis != "")
                {
                    intInsertHis = sqlTrans.ExecuteNonQuery(strInsertHis, CommandType.Text, null);
                }
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                if (strUpdate != "")
                {
                    intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, para);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 16
0
        public static int InsertApproval(string PID, string RelevanceID, string webkey, string folderBack, ref string a_strErr)
        {
            int         intInsertBas = 0;
            int         intUpdateBas = 0;
            int         intLog       = 0;
            Acc_Account account      = GAccount.GetAccountInfo();
            string      createUser   = account.UserID.ToString();
            SQLTrans    sqlTrans     = new SQLTrans();

            sqlTrans.Open();
            string[] arr = folderBack.Split('/');
            // BGOI_BasMan/tk_SApproval/tk_SupplierBas/SID/10/52/tk_PID/54/tk_UserLog
            string strInsertBas = "insert into [" + arr[0] + "].." + arr[1] + " (PID,RelevanceID,ApprovalContent,CreateUser,CreateTime,Validate,State,Job,ApprovalPersons,ApprovalLevel,AppType)"
                                  + " select '" + PID + "','" + RelevanceID + "','" + webkey + "','" + createUser + "','" + DateTime.Now + "','v','0',Duty,UserId,[Level],AppType from [BJOI_UM]..UM_Examine where BuType = '" + webkey + "'";

            string strUpdateBas = "";

            if (arr[2].IndexOf("..") > 0)
            {
                strUpdateBas = "update " + arr[2] + " set State = '" + arr[5] + "' where " + arr[3] + " = '" + RelevanceID + "'";
            }
            else
            {
                strUpdateBas = "update [" + arr[0] + "].." + arr[2] + " set State = '" + arr[5] + "' where " + arr[3] + " = '" + RelevanceID + "'";
            }

            string strInsertLog = "insert into [" + arr[0] + "].." + arr[8] + " values ('" + RelevanceID + "','提交" + webkey + "审批操作','提交" + webkey + "审批成功','" + DateTime.Now + "','" + account.UserName + "','" + webkey + "')";

            try
            {
                if (strInsertBas != "")
                {
                    intInsertBas = sqlTrans.ExecuteNonQuery(strInsertBas, CommandType.Text, null);
                }
                if (strUpdateBas != "")
                {
                    intUpdateBas = sqlTrans.ExecuteNonQuery(strUpdateBas, CommandType.Text, null);
                }
                if (strInsertLog != "")
                {
                    intLog = sqlTrans.ExecuteNonQuery(strInsertLog, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsertBas + intUpdateBas);
        }
Exemplo n.º 17
0
        // 确认新增小组人员
        public static int InsertGroupUser(string text, string GroupID, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("AccountCnn");
            string    strSql = "select max(UserID) UserID from UM_Person where Validate='v' ";
            DataTable dt     = SQLBase.FillTable(strSql, "AccountCnn");
            string    UserID = "U";

            if (dt.Rows.Count > 0)
            {
                string strID = dt.Rows[0]["UserID"].ToString();
                strID = strID.Substring(1, strID.Length - 1);
                int IDs    = Convert.ToInt32(strID) + 1;
                int length = 7 - IDs.ToString().Length;
                for (int i = 0; i < length; i++)
                {
                    UserID += "0";
                }
                UserID += IDs.ToString();
            }
            else
            {
                UserID = "U0000001";
            }
            string strInsertOrder = "insert into UM_Person (UserID,UserName,GroupID,Validate) ";

            strInsertOrder += " values ('" + UserID + "','" + text + "','" + GroupID + "','v') ";
            try
            {
                if (strInsertOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null);
                }

                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 18
0
        public static int InsertTemporary(string ProductName, string Spc, string Pid, string Num, string RelevanceID, string dataT, ref string a_strErr)
        {
            int      intInsertBas = 0;
            SQLTrans sqlTrans     = new SQLTrans();

            sqlTrans.Open();
            string[] arrName = ProductName.Split(',');
            string[] arrSpc  = Spc.Split(',');
            string[] arrPid  = Pid.Split(',');
            string[] arrNum  = Num.Split(',');

            string strInsertBas = "";

            for (int i = 0; i < arrName.Length; i++)
            {
                string DID = "";
                if (i <= 9)
                {
                    DID = RelevanceID + "-0" + (i + 1);
                }
                else
                {
                    DID = RelevanceID + "-" + (i + 1);
                }
                strInsertBas += "insert into " + dataT + " (RWID,DID,OrderContent,SpecsModels,OrderUnit,OrderNum,DeliveryTime,State,PID) values ('" + RelevanceID + "','" + DID + "','" + arrName[i] + "',"
                                + "'" + arrSpc[i] + "','个','" + arrNum[i] + "','" + DateTime.Now + "','0','" + arrPid[i] + "')";
            }

            try
            {
                if (strInsertBas != "")
                {
                    intInsertBas = sqlTrans.ExecuteNonQuery(strInsertBas, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsertBas);
        }
Exemplo n.º 19
0
        // 确认新增小组
        public static int InsertGroup(string text, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("AccountCnn");
            string    strSql  = "select top 1 GroupID,DeptId from UM_Group  where Validate='v' order by GroupID desc ";
            DataTable dt      = SQLBase.FillTable(strSql, "AccountCnn");
            int       GroupID = 0;
            string    DeptID  = "";

            if (dt.Rows.Count > 0)
            {
                GroupID = Convert.ToInt32(dt.Rows[0]["GroupID"].ToString()) + 1;
                DeptID  = dt.Rows[0]["DeptId"].ToString();
            }
            else
            {
                GroupID = 1;
                Acc_Account acc = GAccount.GetAccountInfo();
                DeptID = acc.UnitID;
            }
            string strInsertOrder = "insert into UM_Group (GroupID,GroupName,DeptId,Validate) ";

            strInsertOrder += " values ('" + GroupID + "','" + text + "','" + DeptID + "','v') ";
            try
            {
                if (strInsertOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null);
                }

                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 20
0
        // 确认新增
        public static int InsertBasic(string type, string text, ref string a_strErr)
        {
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("FlowMeterDBCnn");
            string    XID      = PreGetTaskNo(type);
            string    strSql   = "select SID,TypeDesc from tk_ConfigContent where Type='" + type + "' and validate='v' ";
            DataTable dt       = SQLBase.FillTable(strSql, "FlowMeterDBCnn");
            string    SID      = "";
            string    TypeDesc = "";

            if (dt.Rows.Count > 0)
            {
                SID      = dt.Rows[0]["SID"].ToString();
                SID      = SID.Substring(0, SID.Length - 1);
                SID      = SID + XID;
                TypeDesc = dt.Rows[0]["TypeDesc"].ToString();
            }
            string strInsertOrder = "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate) ";

            strInsertOrder += " values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v') ";
            try
            {
                if (strInsertOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null);
                }

                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 21
0
        public static int InsertCongTime(string checkWay, string num, string unit, string TimeType, ref string a_strErr)
        {
            int      intdelete = 0;
            int      intInsert = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string    strSql    = "select * from tk_ConfigWarnTime where Unit = '" + unit + "' and Type = '" + checkWay + "'";
            DataTable dt        = SQLBase.FillTable(strSql, "SupplyCnn");
            string    strdelete = "";

            if (dt.Rows.Count > 0)
            {
                strdelete = "delete from tk_ConfigWarnTime where Unit = '" + unit + "' and Type = '" + checkWay + "'";
            }
            string strInsert = "Insert into tk_ConfigWarnTime (num,Type,TimeType,Unit) values ('" + num + "','" + checkWay + "','" + TimeType + "','" + unit + "')";

            try
            {
                if (strdelete != "")
                {
                    intdelete = sqlTrans.ExecuteNonQuery(strdelete, CommandType.Text, null);
                }
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }
Exemplo n.º 22
0
        public static int InsertExamine(string Butype, string allcontent, ref string a_strErr)
        {
            int      intInsertBas = 0;
            int      intDelete    = 0;
            SQLTrans sqlTrans     = new SQLTrans();

            sqlTrans.Open();
            string[] arr          = allcontent.Split('@');
            string   strDelete    = "delete from [BJOI_UM]..UM_Examine where BuType = '" + Butype + "'";
            string   strInsertBas = "";

            for (int i = 0; i < arr.Length; i++)
            {
                string[] brr = arr[i].Split('/');
                strInsertBas += "insert into [BJOI_UM]..UM_Examine (Duty,UserId,BuType,[Level],AppType) values ('" + brr[1] + "','" + brr[0] + "','" + Butype + "','" + brr[2] + "','" + brr[3] + "')";
            }
            try
            {
                if (strDelete != "")
                {
                    intDelete = sqlTrans.ExecuteNonQuery(strDelete, CommandType.Text, null);
                }
                if (strInsertBas != "")
                {
                    intInsertBas = sqlTrans.ExecuteNonQuery(strInsertBas, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsertBas);
        }
Exemplo n.º 23
0
        public static UIDataTable LoadYearAnaly(string where)
        {
            var       y    = DateTime.Now.Year;
            ArrayList year = new ArrayList();

            for (int i = 1998; i <= y; i++)
            {
                year.Add(i);
            }


            SQLTrans sqlTrans = new SQLTrans();

            sqlTrans.Open("FlowMeterDBCnn");
            UIDataTable instData = new UIDataTable();
            DataTable   dt       = new DataTable();

            dt.Columns.Add("年份", typeof(System.String));
            dt.Columns.Add("总表数", typeof(System.String));
            dt.Columns.Add("总问题表数", typeof(System.String));
            dt.Columns.Add("总故障率", typeof(System.String));
            dt.Columns.Add("大问题表数", typeof(System.String));
            dt.Columns.Add("大问题故障率", typeof(System.String));
            dt.Columns.Add("影响计量问题表数", typeof(System.String));
            dt.Columns.Add("影响计量故障率", typeof(System.String));

            for (int i = 0; i < year.Count; i++)
            {
                string rid = "and  RID in (select RID from tk_RepairCard where DATEPART(year,FactoryDate)=" + year[i] + ")";

                if (where != "")
                {
                    rid = "and  RID in (select RID from tk_RepairCard where DATEPART(year,FactoryDate)=" + year[i] + where + ")";
                }
                string sql = "select " + year[i] + " as '年份',";
                sql += "(select COUNT(*)    from tk_RepairCard  where 1=1 " + rid + " ) '总数', ";
                sql += "(select COUNT(*)    from tk_RepairInfo  where 1=1 " + rid + ") '总问题', ";
                sql += "(select COUNT(*)  from tk_GenQtn where TotalPriceU>'2000' " + rid + " ) '大问题',";
                sql += "(select COUNT(*) from  (select  COUNT(*) C from tk_RepairDevice where 1=1 " + rid + " group by  RID ) B ) '影响计量'";
                DataTable DO_Order = SQLBase.FillTable(sql, "FlowMeterDBCnn");
                for (int j = 0; j < DO_Order.Rows.Count; j++)
                {
                    DataRow newRow = dt.NewRow();
                    newRow["年份"]    = DO_Order.Rows[0]["年份"];
                    newRow["总表数"]   = DO_Order.Rows[0]["总数"];
                    newRow["总问题表数"] = DO_Order.Rows[0]["总问题"];
                    double s = 0.00;
                    if (DO_Order.Rows[0]["总数"].ToString() != "0")
                    {
                        if (DO_Order.Rows[0]["总问题"].ToString() == "0")
                        {
                            newRow["总故障率"] = "0.00%";
                        }
                        else
                        {
                            s = Convert.ToDouble(DO_Order.Rows[0]["总问题"]) / Convert.ToDouble(DO_Order.Rows[0]["总数"]) * 100;
                            newRow["总故障率"] = Math.Round(s, 2).ToString() + "%";
                        }
                    }
                    else
                    {
                        newRow["总故障率"] = "0.00%";
                    }

                    newRow["大问题表数"] = DO_Order.Rows[0]["大问题"];
                    if (DO_Order.Rows[0]["总数"].ToString() != "0")
                    {
                        if (DO_Order.Rows[0]["大问题"].ToString() == "0")
                        {
                            newRow["大问题故障率"] = "0.00%";
                        }
                        else
                        {
                            s = Convert.ToDouble(DO_Order.Rows[0]["大问题"]) / Convert.ToDouble(DO_Order.Rows[0]["总数"]) * 100;
                            newRow["大问题故障率"] = Math.Round(s, 2).ToString() + "%";
                        }
                    }
                    else
                    {
                        newRow["大问题故障率"] = "0.00%";
                    }


                    newRow["影响计量问题表数"] = DO_Order.Rows[0]["影响计量"];

                    if (DO_Order.Rows[0]["总数"].ToString() != "0")
                    {
                        if (DO_Order.Rows[0]["影响计量"].ToString() == "0")
                        {
                            newRow["影响计量故障率"] = "0.00%";
                        }
                        else
                        {
                            s = Convert.ToDouble(DO_Order.Rows[0]["影响计量"]) / Convert.ToDouble(DO_Order.Rows[0]["总数"]) * 100;
                            newRow["影响计量故障率"] = Math.Round(s, 2).ToString() + "%";
                        }
                    }
                    else
                    {
                        newRow["影响计量故障率"] = "0.00%";
                    }


                    dt.Rows.Add(newRow);
                }
            }



            instData.DtData = dt;
            return(instData);
        }
Exemplo n.º 24
0
        public static UIDataTable LoadCalibreAnaly(string where)
        {
            ArrayList Calibre = new ArrayList();

            Calibre.Add(50); Calibre.Add(80); Calibre.Add(100);
            Calibre.Add(150); Calibre.Add(200); Calibre.Add(250);
            Calibre.Add(300); Calibre.Add(400); Calibre.Add(500);
            SQLTrans sqlTrans = new SQLTrans();

            sqlTrans.Open("FlowMeterDBCnn");
            UIDataTable instData = new UIDataTable();
            DataTable   dt       = new DataTable();

            dt.Columns.Add("口径", typeof(System.String));
            dt.Columns.Add("总表数", typeof(System.String));
            dt.Columns.Add("总问题表数", typeof(System.String));
            dt.Columns.Add("总故障率", typeof(System.String));
            dt.Columns.Add("大问题表数", typeof(System.String));
            dt.Columns.Add("大问题故障率", typeof(System.String));
            dt.Columns.Add("影响计量问题表数", typeof(System.String));
            dt.Columns.Add("影响计量故障率", typeof(System.String));

            for (int i = 0; i < Calibre.Count; i++)
            {
                string rid = "and  RID in (select RID from tk_RepairCard where Caliber='" + Calibre[i] + "')";

                if (where != "")
                {
                    rid = "and  RID in (select RID from tk_RepairCard where Caliber='" + Calibre[i] + "'" + where + ")";
                }
                string sql = "select " + Calibre[i] + " as '口径',";
                sql += "(select COUNT(*)    from tk_RepairCard  where 1=1 " + rid + " ) '总数', ";
                sql += "(select COUNT(*)    from tk_RepairInfo  where 1=1 " + rid + ") '总问题', ";
                sql += "(select COUNT(*)  from tk_GenQtn where TotalPriceU>'2000' " + rid + " ) '大问题',";
                sql += "(select COUNT(*) from  (select  COUNT(*) C from tk_RepairDevice where 1=1 " + rid + " group by  RID ) B ) '影响计量'";
                DataTable DO_Order = SQLBase.FillTable(sql, "FlowMeterDBCnn");
                for (int j = 0; j < DO_Order.Rows.Count; j++)
                {
                    DataRow newRow = dt.NewRow();
                    newRow["口径"]    = "DN" + DO_Order.Rows[0]["口径"];
                    newRow["总表数"]   = DO_Order.Rows[0]["总数"];
                    newRow["总问题表数"] = DO_Order.Rows[0]["总问题"];
                    double s = 0.00;
                    if (DO_Order.Rows[0]["总数"].ToString() != "0")
                    {
                        if (DO_Order.Rows[0]["总问题"].ToString() == "0")
                        {
                            newRow["总故障率"] = "0.00%";
                        }
                        else
                        {
                            s = Convert.ToDouble(DO_Order.Rows[0]["总问题"]) / Convert.ToDouble(DO_Order.Rows[0]["总数"]) * 100;
                            newRow["总故障率"] = Math.Round(s, 2).ToString() + "%";
                        }
                    }
                    else
                    {
                        newRow["总故障率"] = "0.00%";
                    }

                    newRow["大问题表数"] = DO_Order.Rows[0]["大问题"];
                    if (DO_Order.Rows[0]["总数"].ToString() != "0")
                    {
                        if (DO_Order.Rows[0]["大问题"].ToString() == "0")
                        {
                            newRow["大问题故障率"] = "0.00%";
                        }
                        else
                        {
                            s = Convert.ToDouble(DO_Order.Rows[0]["大问题"]) / Convert.ToDouble(DO_Order.Rows[0]["总数"]) * 100;
                            newRow["大问题故障率"] = Math.Round(s, 2).ToString() + "%";
                        }
                    }
                    else
                    {
                        newRow["大问题故障率"] = "0.00%";
                    }


                    newRow["影响计量问题表数"] = DO_Order.Rows[0]["影响计量"];

                    if (DO_Order.Rows[0]["总数"].ToString() != "0")
                    {
                        if (DO_Order.Rows[0]["影响计量"].ToString() == "0")
                        {
                            newRow["影响计量故障率"] = "0.00%";
                        }
                        else
                        {
                            s = Convert.ToDouble(DO_Order.Rows[0]["影响计量"]) / Convert.ToDouble(DO_Order.Rows[0]["总数"]) * 100;
                            newRow["影响计量故障率"] = Math.Round(s, 2).ToString() + "%";
                        }
                    }
                    else
                    {
                        newRow["影响计量故障率"] = "0.00%";
                    }


                    dt.Rows.Add(newRow);
                }
            }



            instData.DtData = dt;
            return(instData);
        }
Exemplo n.º 25
0
        public static int UpdateContent(string xid, string type, string text, ref string a_strErr)
        {
            int      intInsert = 0;
            int      intUP     = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsertOrder = "";
            string strup          = "";

            //判断类型
            if (type == "BusinessDistribute")
            {
                strInsertOrder += "update  tk_BusinessDistribute  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
                strup          += "update  tk_ConfigContent  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
            }
            else if (type == "BillingWay")
            {
                strInsertOrder += "update  tk_ConfigBillWay  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
                strup          += "update  tk_ConfigContent  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
            }
            else if (type == "CPZLZXBZ")
            {
                strInsertOrder += "update  tk_ConfigQualityStandard  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
                strup          += "update  tk_ConfigContent  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
            }
            else if (type == "Relation")
            {
                strInsertOrder += "update  tk_ConfigReation  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
                strup          += "update  tk_ConfigContent  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
            }
            else if (type == "ScaleType")
            {
                strInsertOrder += "update  tk_ConfigScalType  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
                strup          += "update  tk_ConfigContent  set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
            }
            else
            {
                strInsertOrder += "update tk_ConfigContent set Text = '" + text + "' where XID = '" + xid + "' and Type = '" + type + "'";
            }
            try
            {
                if (strInsertOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null);
                }
                if (strup != "")
                {
                    intUP = sqlTrans.ExecuteNonQuery(strup, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert + intUP);
        }
Exemplo n.º 26
0
        public static int InsertContent(string type, string text, ref string a_strErr)
        {
            int      intInsert  = 0;
            int      intContent = 0;
            SQLTrans sqlTrans   = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string      XID      = PreGetTaskNo(type);
            string      strSql   = "select SID,TypeDesc from tk_ConfigContent where Type='" + type + "'";
            DataTable   dt       = SQLBase.FillTable(strSql, "SupplyCnn");
            string      SID      = "";
            string      TypeDesc = "";
            Acc_Account acc      = GAccount.GetAccountInfo();

            if (dt.Rows.Count > 0)
            {
                SID      = dt.Rows[0]["SID"].ToString();
                SID      = SID.Substring(0, SID.Length - 1);
                SID      = SID + (Convert.ToInt32(XID) - 1).ToString();
                TypeDesc = dt.Rows[0]["TypeDesc"].ToString();
            }
            string strInsertOrder = "";
            string strConte       = "";

            //在此处判断
            if (type == "BusinessDistribute")
            {
                strInsertOrder += "insert into tk_BusinessDistribute (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
                strConte       += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
            }
            else if (type == "BillingWay")
            {
                strInsertOrder += "insert into tk_ConfigBillWay (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
                strConte       += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
            }
            else if (type == "CPZLZXBZ")
            {
                strInsertOrder += "insert into tk_ConfigQualityStandard (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
                strConte       += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
            }
            else if (type == "Relation")
            {
                strInsertOrder += "insert into tk_ConfigReation (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
                strConte       += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
            }
            else if (type == "ScaleType")
            {
                strInsertOrder += "insert into tk_ConfigScalType (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
                strConte       += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
            }
            else
            {
                strInsertOrder += "insert into tk_ConfigContent (XID,SID,Text,Type,TypeDesc,Validate,UnitID) values ('" + XID + "','" + SID + "','" + text + "','" + type + "','" + TypeDesc + "','v','" + acc.UnitID + "')";
            }
            try
            {
                if (strInsertOrder != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsertOrder, CommandType.Text, null);
                }
                if (strConte != "")
                {
                    intContent = sqlTrans.ExecuteNonQuery(strConte, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert + intContent);
        }
Exemplo n.º 27
0
        public static int InsertDCheckInfo(DCheckInfo CheckInfo, ref string a_strErr)
        {
            int      intInsert = 0;
            int      intUpdate = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string   strInsert = GSqlSentence.GetInsertInfoByD <DCheckInfo>(CheckInfo, "tk_DCheckInfo");
            string   strUpdate = "";
            DateTime CheckDate = Convert.ToDateTime(CheckInfo.StrCheckDate);
            DateTime PlanDate  = new DateTime();
            string   strSql    = "";

            strSql = "select CycleType,Cycle from tk_DevicsBas where ECode = '" + CheckInfo.StrECode + "'";
            DataTable dt        = SQLBase.FillTable(strSql, "SupplyCnn");
            string    CycelType = dt.Rows[0]["CycleType"].ToString();
            int       Cycel     = Convert.ToInt16(dt.Rows[0]["Cycle"]);

            if (CycelType == "Cy1")
            {
                PlanDate = CheckDate.AddYears(Cycel);
            }
            if (CycelType == "Cy2")
            {
                PlanDate = CheckDate.AddMonths(Cycel);
            }
            if (CycelType == "Cy3")
            {
                PlanDate = CheckDate.AddDays(Cycel);
            }
            if (CheckInfo.StrPrecision != null)
            {
                strUpdate = "update tk_DevicsBas set LastDate = '" + CheckInfo.StrCheckDate + "',PlanDate = '" + PlanDate.ToString("yyyy-MM-dd") + "',Precision = '" + CheckInfo.StrPrecision + "' where ECode = '" + CheckInfo.StrECode + "'";
            }
            else
            {
                strUpdate = "update tk_DevicsBas set LastDate = '" + CheckInfo.StrCheckDate + "',PlanDate = '" + PlanDate.ToString("yyyy-MM-dd") + "' where ECode = '" + CheckInfo.StrECode + "'";
            }



            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                if (strUpdate != "")
                {
                    intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert + intUpdate);
        }
Exemplo n.º 28
0
        public static int UpdateDCheckInfo(DCheckInfo CheckInfo, string id, string num, ref string a_strErr)
        {
            int      intInsert = 0;
            int      intUpdate = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");
            string strInsert = "update tk_DCheckInfo set CheckDate = '" + CheckInfo.StrCheckDate + "',CheckWay = '" + CheckInfo.StrCheckWay + "',CheckCompany = '" + CheckInfo.StrCheckCompany + "',Charge = '" + CheckInfo.StrCharge + "',"
                               + "Precision = '" + CheckInfo.StrPrecision + "',CensorshipRemark = '" + CheckInfo.StrCensorshipRemark + "',Principal = '" + CheckInfo.StrPrincipal + "',CalibrationResults = '" + CheckInfo.StrCalibrationResults + "' where ID = '" + id + "'";
            string strUpdate = "";

            if (num == "1")
            {
                DateTime CheckDate = Convert.ToDateTime(CheckInfo.StrCheckDate); DateTime PlanDate = new DateTime();
                string   strSql = "";
                if (CheckInfo.StrCheckWay == "CK1")
                {
                    strSql = "select CalibrationCycleType,CalibrationCycle from tk_DevicsBas where ECode = '" + CheckInfo.StrECode + "'";
                    DataTable dt        = SQLBase.FillTable(strSql, "SupplyCnn");
                    string    CycelType = dt.Rows[0]["CalibrationCycleType"].ToString();
                    int       Cycel     = Convert.ToInt16(dt.Rows[0]["CalibrationCycle"]);
                    if (CycelType == "Cy1")
                    {
                        PlanDate = CheckDate.AddYears(Cycel);
                    }
                    if (CycelType == "Cy2")
                    {
                        PlanDate = CheckDate.AddMonths(Cycel);
                    }
                    if (CycelType == "Cy3")
                    {
                        PlanDate = CheckDate.AddDays(Cycel);
                    }
                    if (CheckInfo.StrPrecision != null)
                    {
                        strUpdate = "update tk_DevicsBas set LastCalibrationDate = '" + CheckInfo.StrCheckDate + "',PlanCalibrationDate = '" + PlanDate.ToString("yyyy-MM-dd") + "',Precision = '" + CheckInfo.StrPrecision + "' where ECode = '" + CheckInfo.StrECode + "'";
                    }
                    else
                    {
                        strUpdate = "update tk_DevicsBas set LastCalibrationDate = '" + CheckInfo.StrCheckDate + "',PlanCalibrationDate = '" + PlanDate.ToString("yyyy-MM-dd") + "' where ECode = '" + CheckInfo.StrECode + "'";
                    }
                }
                if (CheckInfo.StrCheckWay == "CK2")
                {
                    strSql = "select CheckCycleType,CheckCycle from tk_DevicsBas where ECode = '" + CheckInfo.StrECode + "'";
                    DataTable dt        = SQLBase.FillTable(strSql, "SupplyCnn");
                    string    CycelType = dt.Rows[0]["CheckCycleType"].ToString();
                    int       Cycel     = Convert.ToInt16(dt.Rows[0]["CheckCycle"]);
                    if (CycelType == "Cy1")
                    {
                        PlanDate = CheckDate.AddYears(Cycel);
                    }
                    if (CycelType == "Cy2")
                    {
                        PlanDate = CheckDate.AddMonths(Cycel);
                    }
                    if (CycelType == "Cy3")
                    {
                        PlanDate = CheckDate.AddDays(Cycel);
                    }
                    if (CheckInfo.StrPrecision != null)
                    {
                        strUpdate = "update tk_DevicsBas set LastCheckDate = '" + CheckInfo.StrCheckDate + "',PlanCheckDate = '" + PlanDate.ToString("yyyy-MM-dd") + "',Precision = '" + CheckInfo.StrPrecision + "' where ECode = '" + CheckInfo.StrECode + "'";
                    }
                    else
                    {
                        strUpdate = "update tk_DevicsBas set LastCheckDate = '" + CheckInfo.StrCheckDate + "',PlanCheckDate = '" + PlanDate.ToString("yyyy-MM-dd") + "' where ECode = '" + CheckInfo.StrECode + "'";
                    }
                }
                if (CheckInfo.StrCheckWay == "CK3")
                {
                    strSql = "select TestCycleType,TestCycle from tk_DevicsBas where ECode = '" + CheckInfo.StrECode + "'";
                    DataTable dt        = SQLBase.FillTable(strSql, "SupplyCnn");
                    string    CycelType = dt.Rows[0]["TestCycleType"].ToString();
                    int       Cycel     = Convert.ToInt16(dt.Rows[0]["TestCycle"]);
                    if (CycelType == "Cy1")
                    {
                        PlanDate = CheckDate.AddYears(Cycel);
                    }
                    if (CycelType == "Cy2")
                    {
                        PlanDate = CheckDate.AddMonths(Cycel);
                    }
                    if (CycelType == "Cy3")
                    {
                        PlanDate = CheckDate.AddDays(Cycel);
                    }
                    if (CheckInfo.StrPrecision != null)
                    {
                        strUpdate = "update tk_DevicsBas set LastTestDate = '" + CheckInfo.StrCheckDate + "',PlanTestDate = '" + PlanDate.ToString("yyyy-MM-dd") + "',Precision = '" + CheckInfo.StrPrecision + "' where ECode = '" + CheckInfo.StrECode + "'";
                    }
                    else
                    {
                        strUpdate = "update tk_DevicsBas set LastTestDate = '" + CheckInfo.StrCheckDate + "',PlanTestDate = '" + PlanDate.ToString("yyyy-MM-dd") + "' where ECode = '" + CheckInfo.StrECode + "'";
                    }
                }
            }

            try
            {
                if (strInsert != "")
                {
                    intInsert = sqlTrans.ExecuteNonQuery(strInsert, CommandType.Text, null);
                }
                if (strUpdate != "")
                {
                    intUpdate = sqlTrans.ExecuteNonQuery(strUpdate, CommandType.Text, null);
                }
                sqlTrans.Close(true);
            }
            catch (SqlException e)
            {
                sqlTrans.Close(false);
                a_strErr = e.Message;
                return(-1);
            }

            return(intInsert);
        }