Example #1
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);
        }
Example #2
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);
        }
Example #3
0
        public static bool InsertMandate(MandateInfo mandate, List <SampleInfo> sampleList, ref string err)
        {
            string          MandateSql   = GSqlSentence.GetInsertInfoByD <MandateInfo>(mandate, "MandateInfo");
            string          sampleSql    = GSqlSentence.GetInsertByList <SampleInfo>(sampleList, "SampleInfo");
            List <TestItem> testItemList = GetItemIDs(mandate.TestingItems, mandate.YYCode);
            string          testItemSql  = GSqlSentence.GetInsertByList <TestItem>(testItemList, "TestItem");
            string          sql          = "select count(*) from MandateInfo where YYCode='" + mandate.YYCode + "'";

            try
            {
                if ((int)SQLBase.ExecuteScalar(sql) > 0)
                {
                    err = "该委托单已添加";
                    return(false);
                }


                if (SQLBase.ExecuteNonQuery(MandateSql) > 0)
                {
                    if (!UpdateYYCode(mandate.YYCode))
                    {
                        err = "预约号更新失败";
                        return(false);
                    }

                    if (sampleList.Count > 0)
                    {
                        if (SQLBase.ExecuteNonQuery(sampleSql) <= 0)
                        {
                            err = "样品信息添加失败";
                            return(false);
                        }
                    }
                    if (testItemList.Count > 0)
                    {
                        if (SQLBase.ExecuteNonQuery(testItemSql) <= 0)
                        {
                            err = "检测项目添加失败";
                            return(false);
                        }
                    }
                    string content = "添加委托单信息";
                    if (!insertLog(mandate.YYCode, content))
                    {
                        err = "更新日志失败";
                        return(false);
                    }

                    return(true);
                }
                err = "委托信息添加失败";
            }
            catch (Exception e)
            {
                err = e.Message;
            }


            return(false);
        }
Example #4
0
        public static int InsertLendAptitude(UCertificatLend Lend, ref string a_strErr)
        {
            int      intInsert = 0;
            int      intupdate = 0;
            SQLTrans sqlTrans  = new SQLTrans();

            sqlTrans.Open("SupplyCnn");

            string strInsert = GSqlSentence.GetInsertInfoByD <UCertificatLend>(Lend, "tk_UCertificatLend");
            string strUpdate = "update tk_UserAptitude set State = '1' 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);
        }
Example #5
0
        public static bool SavePayInfo(PayInfo payInfo, List <ConsumptionInfo> list, double yk, ref string err)
        {
            if (payInfo != null)
            {
                string paySql = GSqlSentence.GetInsertInfoByD <PayInfo>(payInfo, "PayInfo");
                if (SQLBase.ExecuteNonQuery(paySql) <= 0)
                {
                    err = "缴费信息添加失败";
                    return(false);
                }
                if (!UpdatePayId(payInfo.PayId))
                {
                    err = "缴费单号更新失败";
                    return(false);
                }
            }
            string conSql = GSqlSentence.GetInsertByList <ConsumptionInfo>(list, "ConsumptionInfo");

            if (SQLBase.ExecuteNonQuery(conSql) <= 0)
            {
                err = "消费信息添加失败";
                return(false);
            }
            if (yk > 0)
            {
                string sql = "update ClientPayInfo set Money = Money-" + yk + " where ClienName ='" + payInfo.PayCompany + "'";
                if (SQLBase.ExecuteNonQuery(sql) <= 0)
                {
                    err = "更新余额失败";
                    return(false);
                }
            }
            string YYCode  = "";
            string Content = "";

            for (int i = 0; i < list.Count; i++)
            {
                YYCode  += list[i].YYCode + ",";
                Content += "缴费,缴费状态为" + list[i].Type + ",";
            }
            if (!insertLog(YYCode.Substring(0, YYCode.Length - 1), Content.Substring(0, Content.Length - 1)))
            {
                err = "更新日志失败";
                return(false);
            }
            return(true);
        }
Example #6
0
        public static bool SaveProductPlan(tk_Product_Plan record, List <tk_Product_PlanDetail> delist, ref string strErr)
        {
            int count = 0;

            try
            {
                string strInsert = GSqlSentence.GetInsertInfoByD <tk_Product_Plan>(record, "[BGOI_Produce].[dbo].tk_Product_Plan");
                if (strInsert != "")
                {
                    count = SQLBase.ExecuteNonQuery(strInsert, "MainProduce");
                }
                if (count <= 0)
                {
                    strErr = "计划单保存失败!";
                    return(false);
                }

                string strInsertList = "";
                if (delist.Count > 0)
                {
                    strInsertList = GSqlSentence.GetInsertByList <tk_Product_PlanDetail>(delist, "tk_Product_PlanDetail");
                    if (strInsertList != "")
                    {
                        count = SQLBase.ExecuteNonQuery(strInsertList, "MainProduce");
                    }
                }

                if (count > 0)
                {
                    return(true);
                }

                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strErr = ex.Message;

                return(false);
            }
        }
Example #7
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);
        }