Beispiel #1
0
        //田字型更新每行字段数
        public bool UpdatePageSizeByTemplateID(Guid TemplateID, decimal ColumnSize)
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BS_TEMPLATE_MAIN set ColumnSize=@ColumnSize ");
            strSql.Append(" where TemplateID=@TemplateID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TemplateID", SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@ColumnSize", SqlDbType.Decimal, 9)
            };
            parameters[0].Value = TemplateID;
            parameters[1].Value = ColumnSize;
            int rows = dbhelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public void AssignProspect(int ContactID, int UserID, int iOldUserID)
        {
            string sSql = "update Prospect set Loanofficer='" + UserID + "' where ContactID=" + ContactID + "; ";

            sSql += "update ProspectTasks set OwnerId='" + UserID + "' where ContactId=" + ContactID + " and OwnerID=" + iOldUserID + " and isnull(Completed,'')=''";
            DbHelperSQL.ExecuteNonQuery(sSql);
        }
Beispiel #3
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    gridView返利单.FocusedRowHandle -= 1;
                    gridView返利单.FocusedRowHandle += 1;
                }
                catch { }

                string        sErr = "";
                int           iCou = 0;
                SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString);
                conn.Open();
                //启用事务
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    if (txt单据号.Text.Trim() == "")
                    {
                        throw new Exception("请选择单据");
                    }

                    string sSQL = @"
select * from [dbo].[_高开返利核销单] where cCode = '{0}' 
";
                    sSQL = string.Format(sSQL, txt单据号.Text.Trim());
                    DataTable dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0];
                    if (dt == null || dt.Rows.Count == 0)
                    {
                        throw new Exception("单据不存在");
                    }

                    DAL._高开返利核销单 dal = new UFIDA.U8.UAP.CustomApp.ControlForm.DAL._高开返利核销单();
                    sSQL = dal.Delete(txt单据号.Text.Trim());
                    iCou = DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL);
                    tran.Commit();

                    if (iCou > 0)
                    {
                        MessageBox.Show("删除成功");

                        this.Close();
                    }
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    throw new Exception(error.Message);
                }
            }
            catch (Exception ee)
            {
                FrmMsgBox f = new FrmMsgBox();
                f.Text = "删除失败";
                f.richTextBox1.Text = ee.Message;
                f.ShowDialog();
            }
        }
Beispiel #4
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public int Insert(ModelCMS_DPInfo model)
        {
            int    returnIntValue = -5;
            string SqlQuery       = " insert into [CMS_DPInfo] "
                                    + "([Name] "
                                    + ",[SubID]"
                                    + ",[Description]"
                                    + ",[CreatePerson]"
                                    + ",[CreateDate]"
                                    + ") values ("
                                    + "'" + model.Name + "'"
                                    + ",'" + model.SubID + "'"
                                    + ",'" + model.Description + "'"
                                    + ",'" + model.CreatePerson + "'"
                                    + ",'" + model.CreateDate + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #5
0
        public void DeletePageLink(SPFile page, SPWeb web)
        {
            var wm       = page.GetLimitedWebPartManager(PersonalizationScope.Shared);
            var webparts = wm.WebParts;

            foreach (WebPart webpart in webparts)
            {
                if (webpart.WebBrowsableObject.ToString() == "CMICT.CSP.Web.BusinessSearch.BusinessSearch.BusinessSearch")
                {
                    CMICT.CSP.Web.BusinessSearch.BusinessSearch.BusinessSearch BS = (BusinessSearch.BusinessSearch)webpart;
                    if (string.IsNullOrEmpty(BS.TemplateID))
                    {
                        continue;
                    }
                    Guid        templateID = new Guid(BS.TemplateID);
                    string      selectSql  = "select templateid from BS_TEMPLATE_PAGES where Url=N'" + page.ServerRelativeUrl + "'";
                    string      sql        = "delete from BS_TEMPLATE_PAGES where Url=N'" + page.ServerRelativeUrl + "'";
                    DbHelperSQL dbhelper   = new DbHelperSQL();

                    DataTable templateDt = dbhelper.ExecuteTable(CommandType.Text, selectSql);

                    dbhelper.ExecuteNonQuery(CommandType.Text, sql);


                    if (templateDt != null && templateDt.Rows.Count > 0)
                    {
                        foreach (DataRow dr in templateDt.Rows)
                        {
                            RefreshTemplateStatus(Convert.ToString(dr["templateid"]));
                        }
                    }
                }
            }
        }
Beispiel #6
0
        /// <summary>
        /// 通过存储过程更新一条学生信息
        /// </summary>
        /// <param name="stu"></param>
        /// <returns></returns>
        public int UpdateStudentByProc(Student stu)
        {
            SqlParameter param1 = new SqlParameter("@stuId", SqlDbType.VarChar, 10);

            param1.Value = stu.StuId;
            SqlParameter param2 = new SqlParameter("@stuName", SqlDbType.VarChar, 50);

            param2.Value = stu.StuName;
            SqlParameter param3 = new SqlParameter("@stuSex", SqlDbType.Bit);

            param3.Value = stu.StuSex;
            SqlParameter param4 = new SqlParameter("@stuBornDate", SqlDbType.DateTime);

            param4.Value = stu.StuBornDate;
            SqlParameter param5 = new SqlParameter("@gradeId", SqlDbType.VarChar, 10);

            param5.Value = stu.GradeId;
            SqlParameter param6 = new SqlParameter("@id", SqlDbType.Int);

            param6.Value = stu.ID;
            object[] parasValues = { param1.Value, param2.Value, param3.Value, param4.Value, param5.Value, param6.Value };

            int j = DbHelperSQL.ExecuteNonQuery("prUpdateStudent", parasValues);

            return(j);
        }
Beispiel #7
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-02-22
        public int Insert(ModelCMS_RoomType model)
        {
            string SqlQuery = " INSERT INTO [CMS_RoomType] "
                              + "([Name]"
                              + ",[FloorID]"
                              + ",[EquipmentID]"
                              + ",[Description]"
                              + ",[CreatePerson]"
                              + ",[CreateDate]"
                              + " ) VALUES ( "
                              + "'" + model.Name + "'"
                              + "," + model.FloorID + ""
                              + ",'" + model.EquipmentID + "'"
                              + ",'" + model.Description + "'"
                              + ",'" + model.CreatePerson + "'"
                              + ",'" + model.CreateDate + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #8
0
        /// <summary>
        /// update workflow stage
        /// neo 2011-02-16
        /// </summary>
        /// <param name="iWflStageID"></param>
        /// <param name="sWflStageName"></param>
        /// <param name="iSeq"></param>
        /// <param name="bEnabled"></param>
        /// <param name="iDaysFromEstClose"></param>
        /// <param name="iDaysFromCreation"></param>
        public void UpdateWflStageBase(int iWflStageID, Int16 iSeq, bool bEnabled, Int16 iDaysFromEstClose, Int16 iDaysFromCreation, Int16 iCalcMethod)
        {
            string     sSql4   = "UPDATE Template_Wfl_Stages SET SequenceNumber = @SequenceNumber,Enabled = @Enabled,DaysFromEstClose = @DaysFromEstClose,DaysFromCreation = @DaysFromCreation, CalculationMethod=@CalculationMethod WHERE WflStageId=@WflStageId";
            SqlCommand SqlCmd4 = new SqlCommand(sSql4);

            DbHelperSQL.AddSqlParameter(SqlCmd4, "@SequenceNumber", SqlDbType.SmallInt, iSeq);
            DbHelperSQL.AddSqlParameter(SqlCmd4, "@Enabled", SqlDbType.Bit, bEnabled);

            if (iDaysFromEstClose == 0)
            {
                DbHelperSQL.AddSqlParameter(SqlCmd4, "@DaysFromEstClose", SqlDbType.SmallInt, DBNull.Value);
            }
            else
            {
                DbHelperSQL.AddSqlParameter(SqlCmd4, "@DaysFromEstClose", SqlDbType.SmallInt, iDaysFromEstClose);
            }

            if (iDaysFromCreation == 0)
            {
                DbHelperSQL.AddSqlParameter(SqlCmd4, "@DaysFromCreation", SqlDbType.SmallInt, DBNull.Value);
            }
            else
            {
                DbHelperSQL.AddSqlParameter(SqlCmd4, "@DaysFromCreation", SqlDbType.SmallInt, iDaysFromCreation);
            }
            DbHelperSQL.AddSqlParameter(SqlCmd4, "@CalculationMethod", SqlDbType.SmallInt, iCalcMethod);

            DbHelperSQL.AddSqlParameter(SqlCmd4, "@WflStageId", SqlDbType.Int, iWflStageID);

            DbHelperSQL.ExecuteNonQuery(SqlCmd4);
        }
Beispiel #9
0
        /// <summary>
        /// 更新一条数据记录
        /// </summary>
        /// <param name="model">实体类实例</param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-02-22
        public int Update(ModelCMS_DishServer model)
        {
            string sqlQuery = " UPDATE [CMS_DishServer]"
                              + "SET [Name] = '" + model.Name + "',"
                              + "[MnemonicSymbol] = '" + model.MnemonicSymbol + "',"
                              + "[DishTypeID] = " + model.DishTypeID
                              + ",[Cost] = " + model.Cost
                              + ",[MeasuringUnit] = '" + model.MeasuringUnit + "',"
                              + "[Price] = " + model.Cost
                              + ",[Commission] = " + model.Commission
                              + ",[StockGoodsID] = " + model.StockGoodsID
                              + ",[InfoNote] = '" + model.InfoNote + "'"
                              + ",[ModifyPerson] = '" + model.ModifyPerson + "'"
                              + ",[ModifyDate] = '" + model.ModifyDate + "'"
                              + " WHERE [ID]=" + model.ID;

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(sqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #10
0
        /// <summary>
        /// 拆箱
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int iBarCodeUnBox(string sBoxCode)
        {
            int iCou = 0;

            try
            {
                SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString);
                conn.Open();
                //启用事务
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    string sSQL = "update [_BarCodeList] set XBarCode = null where [XBarCode] = '" + sBoxCode + "' and isnull(valid,0) = 1";
                    iCou = iCou + DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL);

                    sSQL = "update [_BarCodeList] set [Used] = 0 where [BarCode] = '" + sBoxCode + "' and isnull(valid,0) = 1";
                    DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL);
                    tran.Commit();
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    throw new Exception(error.Message);
                }
            }
            catch (Exception ee)
            {
                throw new Exception(ee.Message);
            }
            return(iCou);
        }
Beispiel #11
0
        /// <summary>
        /// 条形码作废
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public int iBarCodeInvalid(DataTable dt)
        {
            int iCou = 0;

            try
            {
                SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString);
                conn.Open();
                //启用事务
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string sSQL = "update [_BarCodeList] set [valid] = 0,Used = 1,XBarCode = null where [BarCode] = '" + dt.Rows[i]["条形码"].ToString().Trim() + "'";
                        iCou = iCou + DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL);
                    }
                    tran.Commit();
                }
                catch (Exception error)
                {
                    tran.Rollback();
                    throw new Exception(error.Message);
                }
            }
            catch (Exception ee)
            {
                throw new Exception(ee.Message);
            }
            return(iCou);
        }
Beispiel #12
0
        /// <summary>
        /// 更新一条数据记录
        /// </summary>
        /// <param name="model">实体类实例</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public int  Update(ModelCMS_VIPClient model)
        {
            int    returnIntValue = -5;
            string SqlQuery       = "UPDATE [CMS_VIPClient]"
                                    + " SET [TelPhone] = 110 "
                                    + " ,[VIPTypeID] = '" + model.VIPTypeID + "'"
                                    + " ,[Position] = '" + model.Position + "'"
                                    + " ,[DepName] = '" + model.DepName + "'"
                                    + " ,[Address] = '" + model.Address + "'"
                                    + " ,[VIPCost] = '" + model.VIPCost + "'"
                                    + ",[InfoNote] = '" + model.InfoNote + "'"
                                    + ",[ModifyPerson] = '" + model.ModifyPerson + "'"
                                    + ",[ModifyDate] = '" + model.ModifyDate + "'"
                                    + "WHERE ID =" + model.ID;

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #13
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-2-28
        public int Insert(ModelCMS_BuffetBooking model)
        {
            int    returnIntValue = -5;
            string SqlQuery       = " INSERT INTO [CMS_BuffetBooking] "
                                    + "([BuffetsID]"
                                    + ",[CName]"
                                    + ",[CTelPhone]"
                                    + ",[Transactor]"
                                    + ",[CNum]"
                                    + ",[BooKDate]"
                                    + ",[OverduTtime]"
                                    + ",[InfoNote]"
                                    + " ) VALUES ( "
                                    + "" + model.BuffetsID + ""
                                    + ",'" + model.CName + "'"
                                    + ",'" + model.CTelPhone + "'"
                                    + ",'" + model.Transactor + "'"
                                    + "," + model.CNum + ""
                                    + ",'" + model.BooKDate + "'"
                                    + ",'" + model.OverduTtime + "'"
                                    + ",'" + model.InfoNote + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #14
0
        /// <summary>
        /// 更新一条数据记录
        /// </summary>
        /// <param name="model">实体类实例</param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-02-22
        public int Update(ModelCMS_Employee model)
        {
            int returnIntValue = -5;

            try
            {
                string SqlQuery = "UPDATE [CMS_Employee]"
                                  + "SET [Name] = '" + model.Name + "'"
                                  + ",[Sex] ='" + model.Sex + "'"
                                  + ",[Age] =" + model.Age + ""
                                  + ",[Degree] ='" + model.Degree + "'"
                                  + ",[BirthDate] = '" + model.BirthDate + "'"
                                  + ",[PosID] = '" + model.PosID + "'"
                                  + ",[EntryDate] = '" + model.EntryDate + "'"
                                  + ",[Photo] = '" + model.Photo + "'"
                                  + ",[TelPhone] = '" + model.TelPhone + "'"
                                  + ",[IDCardNum] = '" + model.IDCardNum + "'"
                                  + ",[Address] = '" + model.Address + "'"
                                  + ",[InfoNote] = '" + model.InfoNote + "'"
                                  + ",[ModifyPerson] = '" + model.ModifyPerson + "'"
                                  + ",[ModifyDate] = '" + model.ModifyDate + "'"
                                  + "WHERE [ID]=" + model.ID + "";
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #15
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-2-25
        public int Insert(ModelCMS_RetreatDishes model)
        {
            int    returnIntValue = -5;
            string SqlQuery       = "INSERT INTO [CMS_RetreatDishes] "
                                    + "([DishID]"
                                    + ",[DishNum]"
                                    + ",[CauseID]"
                                    + ",[InfoNote]"
                                    + ",[CreatePerson]"
                                    + ",[RetreatDate]"
                                    + " ) VALUES ( "
                                    + "" + model.DishID + ""
                                    + "," + model.DishNum + ""
                                    + "," + model.CauseID + ""
                                    + ",'" + model.InfoNote + "'"
                                    + ",'" + model.CreatePerson + "'"
                                    + ",'" + model.RetreatDate + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #16
0
 private void Save()
 {
     try
     {
         using (SqlConnection conn = DbHelperSQL.GetOpenConnection())
         {
             try
             {
                 SqlCommand cmd = new SqlCommand(@"INSERT INTO ZillowLogger ([date_created],[thread],[level],[logger],[message],[exception]) VALUES (@a, @b, @c, @d, @e, @f)", conn);
                 DbHelperSQL.AddSqlParameter(cmd, "@a", SqlDbType.DateTime, LogDate);
                 DbHelperSQL.AddSqlParameter(cmd, "@b", SqlDbType.NVarChar, Helpers.FormatSqlStringValue(Thread, 255));
                 DbHelperSQL.AddSqlParameter(cmd, "@c", SqlDbType.NVarChar, Helpers.FormatSqlStringValue(Level, 50));
                 DbHelperSQL.AddSqlParameter(cmd, "@d", SqlDbType.NVarChar, Helpers.FormatSqlStringValue(Logger, 255));
                 DbHelperSQL.AddSqlParameter(cmd, "@e", SqlDbType.NVarChar, Helpers.FormatSqlStringValue(Message, 4000));
                 DbHelperSQL.AddSqlParameter(cmd, "@f", SqlDbType.NVarChar, Helpers.FormatSqlStringValue(Exception, 4000));
                 DbHelperSQL.ExecuteNonQuery(cmd);
             }
             catch (Exception ex)
             {
                 // ignore
             }
         }
     }
     catch (Exception ex)
     {
         //ignore
     }
 }
Beispiel #17
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                int           iCou = 0;
                SqlConnection conn = new SqlConnection(Conn);
                conn.Open();
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    string  sCodeLetter = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridColCodeLetter).ToString().Trim();
                    decimal dAQLLevel   = BaseFunction.ReturnDecimal(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridColAQLLevel));

                    string sSQL = "Delete _AQLLevelMap where CodeLetter = '{0}' and AQLLevel = '{1}'";
                    sSQL = string.Format(sSQL, sCodeLetter, dAQLLevel);
                    DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL);
                    tran.Commit();

                    MessageBox.Show("OK");

                    GetGrid();
                }
                catch (Exception ee)
                {
                    tran.Rollback();
                    throw new Exception(ee.Message);
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Beispiel #18
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-02-23
        /// 整理人:桂书丛
        /// 整理日期:2013-03-01
        public int Insert(ModelCMS_Stock model)
        {
            int returnValue = 0;

            try
            {
                string SqlQuery = string.Empty;
                SqlQuery = " INSERT INTO [CMS_Stock] "
                           + " ([Name]"
                           + ",[Supplier]"
                           + ",[Specifications]"
                           + ",[Price]"
                           + ",[Number]"
                           + ",[InfoNote]"
                           + " ) VALUES ( "
                           + "'" + model.Name + "'"
                           + ",'" + model.Supplier + "'"
                           + ",'" + model.Specifications + "'"
                           + "," + model.Price + ""
                           + "," + model.Number + ""
                           + ",'" + model.InfoNote + "')";
                returnValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #19
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                int           iCou = 0;
                SqlConnection conn = new SqlConnection(Conn);
                conn.Open();
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    string sInvCode = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridColcInvCode).ToString().Trim();

                    string sSQL = @"
update Inventory_extradefine set cidefine4 = null
where cInvCode = '{0}'
";
                    sSQL = string.Format(sSQL, sInvCode);
                    DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL);
                    tran.Commit();

                    MessageBox.Show("OK");

                    GetGrid();
                }
                catch (Exception ee)
                {
                    tran.Rollback();
                    throw new Exception(ee.Message);
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Beispiel #20
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-02-22
        public int Insert(ModelT_Right model)
        {
            int    returnIntValue = -5;
            string SqlQuery       = " INSERT INTO [T_Right]"
                                    + "([ID]"
                                    + ",[Name]"
                                    + ",[Description]"
                                    + ",[CreatePerson]"
                                    + ",[CreateDate]"
                                    + " ) VALUES ("
                                    + "'" + model.ID + "',"
                                    + "'" + model.Name + "',"
                                    + "'" + model.Description + "',"
                                    + "'" + model.CreatePerson + "',"
                                    + "'" + model.CreateDate + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #21
0
        /// <summary>
        /// 通过Sql语句更新一个学生信息
        /// </summary>
        /// <param name="stu">Student对象</param>
        /// <returns></returns>
        public int UpdateStudent(Student stu)
        {
            string strSql = @"UPDATE Student SET StuId=@stuId,StuName=@stuName,StuSex=@stuSex,StuBornDate=@stuBornDate
                                 ,GradeId=@gradeId WHERE ID=@id";

            SqlParameter param1 = new SqlParameter("@stuId", SqlDbType.VarChar, 10);

            param1.Value = stu.StuId;
            SqlParameter param2 = new SqlParameter("@stuName", SqlDbType.VarChar, 50);

            param2.Value = stu.StuName;
            SqlParameter param3 = new SqlParameter("@stuSex", SqlDbType.Bit);

            param3.Value = stu.StuSex;
            SqlParameter param4 = new SqlParameter("@stuBornDate", SqlDbType.DateTime);

            param4.Value = stu.StuBornDate;
            SqlParameter param5 = new SqlParameter("@gradeId", SqlDbType.VarChar, 10);

            param5.Value = stu.GradeId;
            SqlParameter param6 = new SqlParameter("@id", SqlDbType.Int);

            param6.Value = stu.ID;
            SqlParameter[] paras = { param1, param2, param3, param4, param5, param6 };

            int j = DbHelperSQL.ExecuteNonQuery(CommandType.Text, strSql, paras);

            return(j);
        }
Beispiel #22
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-02-22
        public int Insert(ModelCMS_Buffets model)
        {
            string SqlQuery = " INSERT INTO [CMS_Buffets] "
                              + "([Name]"
                              + ",[AccommodateNum]"
                              + ",[RoomTypeID]"
                              + ",[StateID]"
                              + ",[InfoNote]"
                              + ",[CreatePerson]"
                              + ",[CreateDate]"
                              + " ) VALUES ( "
                              + "'" + model.Name + "'"
                              + "," + model.AccommodateNum + ""
                              + "," + model.RoomTypeID + ""
                              + "," + model.StateID + ""
                              + ",'" + model.InfoNote + "'"
                              + ",'" + model.CreatePerson + "'"
                              + ",'" + model.CreateDate + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #23
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                int           iCou = 0;
                SqlConnection conn = new SqlConnection(Conn);
                conn.Open();
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    long lID = BaseFunction.ReturnLong(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridColDefectID));

                    string sSQL = "Delete _DefectMaster_2 where DefectID = {0}";
                    sSQL = string.Format(sSQL, lID);
                    DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL);
                    tran.Commit();

                    MessageBox.Show("OK");

                    GetGrid();
                }
                catch (Exception ee)
                {
                    tran.Rollback();
                    throw new Exception(ee.Message);
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Beispiel #24
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-02-22
        public int Insert(ModelCMS_PaymentsItem model)
        {
            string SqlQuery = " INSERT INTO [CMS_PaymentsItem] "
                              + "([Type]"
                              + ",[Name]"
                              + ",[Description]"
                              + ",[CreatePerson]"
                              + ",[CreateDate]"
                              + " ) VALUES ( "
                              + "'" + model.Type + "'"
                              + ",'" + model.Name + "'"
                              + ",'" + model.Description + "'"
                              + ",'" + model.CreatePerson + "'"
                              + ",'" + model.CreateDate + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #25
0
        /// <summary>
        ///
        ///
        /// </summary>
        /// <param name="sWhere"></param>
        /// <returns></returns>
        public void GetSnoozePopup(string minute, string LoanTaskId)
        {
            string due  = "convert(char(8),Dateadd(minute," + minute + ",convert(datetime,(convert(varchar(11),Due,120)+' '+convert(varchar(10),DueTime,120)))),108)";
            string sSql = "update LoanTasks  set DueTime=" + due + " where 1=1 and LoanTaskId=" + LoanTaskId;

            int i = DbHelperSQL.ExecuteNonQuery(sSql);
        }
Beispiel #26
0
        /// <summary>
        /// 保存UserLoanRep关系
        /// </summary>
        /// <param name="nUserID"></param>
        /// <param name="strLoanRepIds"></param>
        public void SaveUserLoanRep(int nUserID, string strLoanRepIds)
        {
            DeleteLoanRepMapping(null, nUserID);
            string strSql = string.Format("UPDATE dbo.UserLoanRep SET UserId={0} WHERE NameId IN ({1})", nUserID, strLoanRepIds);

            DbHelperSQL.ExecuteNonQuery(strSql);
        }
Beispiel #27
0
        private void btnAudit_Click(object sender, EventArgs e)
        {
            try
            {
                if (!clsUserRight.chkRight(sUserID, 8040))
                {
                    throw new Exception("没有权限");
                }

                if (txtCode.Text.Trim() == "")
                {
                    throw new Exception("请选择单据审核");
                }

                SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString);
                conn.Open();
                SqlTransaction tran = conn.BeginTransaction();
                try
                {
                    string    sSQL   = "select * from  _Scrap where cCode = N'" + txtCode.Text.Trim() + "'";
                    DataTable dtTemp = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0];
                    if (dtTemp == null || dtTemp.Rows.Count == 0)
                    {
                        throw new Exception("单据未保存");
                    }
                    if (dtTemp != null && dtTemp.Rows.Count > 0)
                    {
                        if (dtTemp.Rows[0]["AuditUserName"].ToString().Trim() != "")
                        {
                            throw new Exception("单据已经审核");
                        }
                    }

                    sSQL = "update _Scrap set AuditUserName = N'111111',AuditDate = getdate() where cCode = N'222222'";
                    sSQL = sSQL.Replace("111111", sUserName);
                    sSQL = sSQL.Replace("222222", txtCode.Text.Trim());
                    int iCou = DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL);
                    if (iCou > 0)
                    {
                        tran.Commit();
                        MessageBox.Show("审核成功");

                        GetGrid(txtCode.Text.Trim());
                    }
                    else
                    {
                        throw new Exception("no data");
                    }
                }
                catch (Exception ee)
                {
                    tran.Rollback();
                    throw new Exception(ee.Message);
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Beispiel #28
0
        public int Insert(ModelCMS_PaymentsDetail model)
        {
            string SqlQuery = " INSERT INTO [CMS_PaymentsDetail] "
                              + "([PaymentTypeID]"
                              + ",[Amount]"
                              + ",[HandlesPeopleID]"
                              + ",[InfoNote]"
                              + ",[CreatePerson]"
                              + ",[CreateDate]"
                              + " ) VALUES ("
                              + "" + model.PaymentTypeID + ""
                              + "," + model.Amount + ""
                              + "," + model.HandlesPeopleID + ""
                              + ",'" + model.InfoNote + "'"
                              + ",'" + model.CreatePerson + "'"
                              + ",'" + model.CreateDate + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #29
0
        /// <summary>
        /// 插入一条数据记录
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public int Insert(ModelCMS_VIPType model)
        {
            int    returnIntValue = -5;
            string SqlQuery       = " insert into [CMS_VIPType] "
                                    + "([Name] "
                                    + ",[Discount]"
                                    + ",[Description]"
                                    + ",[ModifyPerson]"
                                    + ",[ModifyDate]"
                                    + ") values ("
                                    + "'" + model.Name + "'"
                                    + "," + model.Discount + ""
                                    + ",'" + model.Description + "'"
                                    + ",'" + model.ModifyPerson + "'"
                                    + ",'" + model.ModifyDate + "')";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #30
0
        /// <summary>
        /// 更新一条数据记录
        /// </summary>
        /// <param name="model">实体类实例</param>
        /// <returns></returns>
        /// 创建人:桂书丛
        /// 创建日期:2013-02-22
        public int Update(ModelCMS_ConsumptionReg model)
        {
            int    returnIntValue = -5;
            string SqlQuery       = "UPDATE [CMS_ConsumptionReg]"
                                    + "SET [CustomerNum] = " + model.CustomerNum + ""
                                    + ",[BuffetsID] = " + model.BuffetsID + ""
                                    + ",[EmployeeID] = " + model.EmployeeID + ""
                                    + ",[TypeID] = " + model.TypeID + ""
                                    + ",[IsPaied] = " + Convert.ToInt32(model.IsPaied) + ""
                                    + ",[TotalAmount] = " + model.TotalAmount + ""
                                    + ",[PayTypeID] = " + model.PayTypeID + ""
                                    + ",[MarkID] = '" + model.MarkID + "'"
                                    + ",[IsVIP] = " + Convert.ToInt32(model.IsVIP) + ""
                                    + ",[VIPID] = " + model.VIPID + ""
                                    + ",[Description] = '" + model.Description + "'"
                                    + ",[ModifyPerson] = '" + model.ModifyPerson + "'"
                                    + ",[ModifyDate] = '" + model.ModifyDate + "'"
                                    + "WHERE [ID]=" + model.ID + "";

            try
            {
                returnIntValue = DbHelperSQL.ExecuteNonQuery(SqlQuery);
                return(returnIntValue);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }