Exemplo n.º 1
0
    protected void gvRecords_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            int          rowid        = Convert.ToInt32(gvRecords.DataKeys[e.RowIndex].Value.ToString());
            DropDownList ddlGvClient  = (DropDownList)gvRecords.Rows[e.RowIndex].FindControl("ddlGvClient");
            DropDownList ddlGvTask    = (DropDownList)gvRecords.Rows[e.RowIndex].FindControl("ddlGvTask");
            DropDownList ddlGvSubTask = (DropDownList)gvRecords.Rows[e.RowIndex].FindControl("ddlGvSubTask");
            TextBox      txtComments  = (TextBox)gvRecords.Rows[e.RowIndex].FindControl("txtComments");

            //Namohar code changes on 10-Aug-2016.
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@client", ddlGvClient.SelectedValue),
                new SqlParameter("@task", ddlGvTask.SelectedValue),
                new SqlParameter("@subTask", ddlGvSubTask.SelectedValue),
                new SqlParameter("@comments", txtComments.Text),
                new SqlParameter("@rowid", rowid)
            };

            SQlQuery = "UPDATE RTM_Records SET R_Client =@client, R_Task=@task, R_SubTask =@subTask, R_Comments=@comments where R_ID=@rowid";
            result   = objDB.ExecuteNonQuery(SQlQuery, CommandType.Text, parameters);

            gvRecords.EditIndex = -1;
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Update Record", "alert('Updated Successfully')", true);
            DisplayRecords();
        }
        catch (Exception ex)
        {
            lblError.Text       = ex.Message;
            lblError.ForeColor  = Color.Red;
            gvRecords.EditIndex = -1;
            DisplayRecords();
        }
    }
Exemplo n.º 2
0
        public ResultInfo SaveIcon(int iconNumber, string iconName, FileInfo file)
        {
            byte[] bytes = BinaryHelper.FileToBytes(file.FullName);
            if (bytes == null)
            {
                return(ResultInfo.Fail);
            }
            SqlDBHelper sqlHelper = new SqlDBHelper();

            sqlHelper.BeginTran();
            try
            {
                string         sqlStr = @"update sadDTICON set IconImage=@IconImage where iconNumber=@iconNumber";
                SqlParameter[] pars   = GetPars(iconNumber, bytes);
                int            line   = sqlHelper.ExecuteNonQuery(sqlStr, pars);
                if (line == 1)
                {
                    sqlHelper.CommitTran();
                    return(ResultInfo.Cover);
                }
                else if (line > 1)
                {
                    sqlHelper.RollBackTran();
                    return(ResultInfo.Fail);
                }
                else
                {
                    //新增
                    if (iconNumber == 0)
                    {
                        iconNumber = Convert.ToInt32(sqlHelper.ExecuteScalar("select max(IconNumber)+1 from sadDTICON"));
                    }
                    if (iconName == "")
                    {
                        iconName = file.Name;
                    }
                    int calc_No = Convert.ToInt32(sqlHelper.ExecuteScalar("select max(Calc_No)+1 from sadDTICON"));
                    sqlStr = string.Format("insert into sadDTICON values ({0},1,@IconImage,'{1}',1,13,GETDATE())",
                                           iconNumber, iconName);
                    pars = GetPars(iconNumber, bytes);
                    int lineIns = sqlHelper.ExecuteNonQuery(sqlStr, pars);
                    if (lineIns == 1)
                    {
                        sqlHelper.CommitTran();
                        return(ResultInfo.Increase);
                    }
                    else
                    {
                        sqlHelper.RollBackTran();
                        return(ResultInfo.Fail);
                    }
                }
            }
            catch (Exception ex)
            {
                sqlHelper.RollBackTran();
                throw ex;
            }
        }
Exemplo n.º 3
0
 public ResultInfo SaveIcon(int iconNumber, string iconName,FileInfo file)
 {
     byte[] bytes = BinaryHelper.FileToBytes(file.FullName);
     if (bytes == null)
     {
         return ResultInfo.Fail;
     }
     SqlDBHelper sqlHelper = new SqlDBHelper();
     sqlHelper.BeginTran();
     try
     {
         string sqlStr = @"update sadDTICON set IconImage=@IconImage where iconNumber=@iconNumber";
         SqlParameter[] pars = GetPars(iconNumber, bytes); 
         int line = sqlHelper.ExecuteNonQuery(sqlStr, pars);
         if(line==1)
         {
             sqlHelper.CommitTran();
             return ResultInfo.Cover;
         }
         else if (line > 1)
         {
             sqlHelper.RollBackTran();
             return ResultInfo.Fail;
         }
         else
         {
             //新增
             if (iconNumber == 0)
             {
                 iconNumber =Convert.ToInt32( sqlHelper.ExecuteScalar("select max(IconNumber)+1 from sadDTICON"));
             }
             if (iconName=="")
             {
                 iconName = file.Name;
             }
             int calc_No = Convert.ToInt32(sqlHelper.ExecuteScalar("select max(Calc_No)+1 from sadDTICON"));
             sqlStr = string.Format("insert into sadDTICON values ({0},1,@IconImage,'{1}',1,13,GETDATE())",
                 iconNumber, iconName);
             pars = GetPars(iconNumber, bytes);
             int lineIns = sqlHelper.ExecuteNonQuery(sqlStr, pars);
             if (lineIns == 1)
             {
                 sqlHelper.CommitTran();
                 return ResultInfo.Increase;
             }
             else
             {
                 sqlHelper.RollBackTran();
                 return ResultInfo.Fail;
             }
         }
     }
     catch(Exception ex)
     {
         sqlHelper.RollBackTran();
         throw ex;
     }       
 }
Exemplo n.º 4
0
        public bool AddClockOut(string recId, DateTime endTime, string duration, string comments)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@recId", recId),
                new SqlParameter("@endTime", endTime),
                new SqlParameter("@duration", duration),
                new SqlParameter("@comments", comments)
            };

            sQuery = "update RTM_Records set R_Duration=@duration, R_CreatedOn=@endTime, R_Status ='Completed', R_Comments=@comments where R_ID =@recId";
            result = objDB.ExecuteNonQuery(sQuery, CommandType.Text, parameters);
            return(result);
        }
Exemplo n.º 5
0
        public bool Add()
        {
            string StrSql = string.Format(@"INSERT INTO reduceGoods(F_proID,Reduce_Sum,Mode,Reduce_date,Why,ClearIncome,ClearCost,CustomerID,Detail)VALUES
           ('{0}','{1}','{2}','{3}','{4}', '{5}','{6}','{7}','{8}')", this.F_proID, this.Reduce_Sum, this.Mode, this.Reduce_date, this.Why, this.ClearIncome, this.ClearCost, this.CustomerID, this.Detail);

            return(SqlDBHelper.ExecuteNonQuery(StrSql));
        }
Exemplo n.º 6
0
        public bool Add()
        {
            string sqlstr = string.Format("insert  Goods(F_proID,GoodsID	,GoodsName,ClassID,OldInfo,Type,MakeName,OldMonth,IntoDate,RepID,DepID,State,AddType,Quantity,JingCanZhi,OrderUnit,Price,Detail,Money,Pro_value)	select'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}' ,'{13}','{14}','{15}','{16}','{17}','{18}','{19}'",
                                          this.F_proID, this.GoodsID, this.GoodsName, this.ClassID, this.OldInfo, this.Type, this.MakeName, this.OldMonth, this.IntoDate, this.RepID, DepID, this.State, this.AddType, this.Quantity, this.JingCanZhi, this.OrderUnit, this.Price, this.Detail, this.Money, this.Pro_value);

            return(SqlDBHelper.ExecuteNonQuery(sqlstr));
        }
Exemplo n.º 7
0
    protected void gvEmployee_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            bool   result;
            string empid = ((Label)gvEmployee.Rows[e.RowIndex].FindControl("lblEmpId")).Text;

            DateTime login = Convert.ToDateTime(((TextBox)gvEmployee.Rows[e.RowIndex].FindControl("txtSCHLogin")).Text);

            DateTime logout = Convert.ToDateTime(((TextBox)gvEmployee.Rows[e.RowIndex].FindControl("txtSCHLogout")).Text);

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@login", login),
                new SqlParameter("@logout", logout),
                new SqlParameter("@empid", empid)
            };

            SQlQuery = "UPDATE RTM_User_List SET UL_SCH_Login=@login, UL_SCH_Logout=@logout where UL_Employee_Id =@empid";
            result   = objDB.ExecuteNonQuery(SQlQuery, CommandType.Text, parameters);

            lblError.Text      = "Updated Succesfully";
            lblError.ForeColor = System.Drawing.Color.Blue;
            //con.Close();
            gvEmployee.EditIndex = -1;
            BindGrid();
        }
        catch (Exception)
        {
            lblError.Text      = "Something went wrong..Please try again";
            lblError.ForeColor = System.Drawing.Color.Red;
        }
    }
Exemplo n.º 8
0
    protected void gvRecords_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        try
        {
            int            rowid        = Convert.ToInt32(gvRecords.DataKeys[e.RowIndex].Value.ToString());
            DropDownList   ddlGvClient  = (DropDownList)gvRecords.Rows[e.RowIndex].FindControl("ddlGvClient");
            DropDownList   ddlGvTask    = (DropDownList)gvRecords.Rows[e.RowIndex].FindControl("ddlGvTask");
            DropDownList   ddlGvSubTask = (DropDownList)gvRecords.Rows[e.RowIndex].FindControl("ddlGvSubTask");
            SqlParameter[] parameters   = new SqlParameter[]
            {
                new SqlParameter("@client", ddlGvClient.SelectedValue),
                new SqlParameter("@task", ddlGvTask.SelectedValue),
                new SqlParameter("@subtask", ddlGvSubTask.SelectedValue),
                new SqlParameter("@id", rowid)
            };

            sQuery = "update rtm_records set R_Client=@client, R_Task=@task , R_SubTask=@subtask where R_ID = @id";
            bool result = objDB.ExecuteNonQuery(sQuery, CommandType.Text, parameters);

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Update Record", "alert('Updated Successfully')", true);

            gvRecords.EditIndex = -1;
            getRecords();
        }
        catch (Exception)
        {
        }
    }
Exemplo n.º 9
0
        public bool Update()
        {
            string StrSql = string.Format(@"UPDATE [dbo].[Borrow]   SET [F_proID] = '{0}',[Borrow_sum] = '{1}',[Borrow_Date] = '{2}',[Predict_date] = '{3}',[NowDate] = '{4}'
,[Predict_money] = '{5}',[Money] = '{6}',[Company] = '{7}',[CustomerID] = '{8}',[Detail] = '{9}' WHERE ID='{10}'",
                                          this.F_proID, this.Borrow_sum, this.Borrow_Date, this.Predict_date, this.NowDate, this.Predict_money, this.Money, this.Company, this.CustomerID, this.Detail, this.BorrowID);

            return(SqlDBHelper.ExecuteNonQuery(StrSql));
        }
Exemplo n.º 10
0
        public bool Add()
        {
            string StrSql = string.Format(@"INSERT INTO borrow(F_proID,Borrow_sum,Borrow_Date,Predict_date,NowDate,Predict_money,Money,Company,CustomerID,Detail)VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')"
                                          , this.F_proID, this.Borrow_sum, this.Borrow_Date,
                                          this.Predict_date, this.NowDate, this.Predict_money, this.Money, this.Company, this.CustomerID, this.Detail);

            return(SqlDBHelper.ExecuteNonQuery(StrSql));
        }
Exemplo n.º 11
0
        public bool Add()
        {
            string StrSql = string.Format(@"INSERT INTO Service ([F_proID],[Service_sum],[Service_Date],[Predict_date],[NowDate],[Cost],[NowCost],[Company]
,[Breakdown],[Service_txt],[Detail])VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')",
                                          this.F_proID, this.Service_sum, this.Service_Date, this.Predict_date, this.NowDate, this.Cost, this.NowCost, this.Company,
                                          this.Breakdown, this.Service_txt, this.Detail);

            return(SqlDBHelper.ExecuteNonQuery(StrSql));
        }
Exemplo n.º 12
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            int    checkedValue = 0;
            string check        = "";
            //Namohar code changes on 10-Aug-2016.
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@checkedValue", checkedValue),
                new SqlParameter("@team", ddlTeam.SelectedValue),
            };
            if (ddlTeam.SelectedIndex == 0)
            {
                lblError.Text      = "Please select Team";
                lblError.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                if (rbNo.Checked == true)
                {
                    checkedValue = 0;
                    check        = "No";
                }
                else if (rbYes.Checked == true)
                {
                    checkedValue = 1;
                    check        = "Yes";
                }

                SQlQuery = "UPDATE RTM_Team_List SET T_Status =@checkedValue  WHERE T_ID =@team";
                result   = objDB.ExecuteNonQuery(SQlQuery, CommandType.Text, parameters);

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "RTM Comments Updated", "alert('RTM Comments for " + ddlTeam.SelectedItem.Text + " is set to " + check + "')", true);
                //lblError.Text = "Updated Successfully";
                //lblError.ForeColor = System.Drawing.Color.Blue;
            }
        }
        catch (Exception)
        {
            lblError.Text      = "Failed.. Please try again";
            lblError.ForeColor = System.Drawing.Color.Red;
        }
    }
Exemplo n.º 13
0
        public bool Update()
        {
            string StrSql = string.Format(@"UPDATE Goods SET[F_proID] = '{0}',[GoodsName] = '{1}',
[ClassID] = '{2}',[Type] = '{3}' ,[MakeName] = '{4}',[OldMonth] = '{5}',[IntoDate] = '{6}',[RepID] = '{7}'
,[DepID] = '{8}',[State] = '{9}',[AddType] = '{10}',[Quantity] = '{11}',[JingCanZhi] = '{12}'
,[OrderUnit] = '{13}',[Price] = '{14}',[Detail] = '{15}',[Money] = '{16}',[Pro_value] = '{17}'
 WHERE GoodsID = '{18}'", this.F_proID, this.GoodsName, this.ClassID, this.Type, this.MakeName, this.OldMonth,
                                          this.IntoDate, this.RepID, this.DepID, this.State, this.AddType, this.Quantity, this.JingCanZhi, this.OrderUnit
                                          , this.Price, this.Detail, this.Money, this.Pro_value, this.GoodsID);

            return(SqlDBHelper.ExecuteNonQuery(StrSql));
        }
Exemplo n.º 14
0
        public bool DeleteEstRecord(string recId)
        {
            bool result;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@recId", recId)
            };

            sQuery = "Delete from RTM_Estimation where EST_ID=@recId";

            result = objDB.ExecuteNonQuery(sQuery, CommandType.Text, parameters);
            return(result);
        }
Exemplo n.º 15
0
        public bool IPAssign(string _fileId, string _status, string _assignedBy, string _assignedTo, string createdOn)
        {
            bool result;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@fileId", _fileId),
                new SqlParameter("@status", _status),
                new SqlParameter("@assignedBy", _assignedBy),
                new SqlParameter("@assignedTo", _assignedTo),
                new SqlParameter("@createdOn", createdOn)
            };
            string sQuery = "Insert into EMSDB_InvDetails (IND_FI, IND_Status, IND_IP_Assigned_By, IND_IP_Processed_By, IND_IP_CreatedOn) values(@fileId, @status, @assignedBy, @assignedTo, @createdOn)";

            result = objDB.ExecuteNonQuery(sQuery, CommandType.Text, parameters);
            //result = objDB.DBExecuteNoNQuery(sQuery);

            return(result);
        }
Exemplo n.º 16
0
        public int DeleteMainSkill(int Id)
        {
            int success = 0;

            try
            {
                object[] param = { Id };
                success = SqlDBHelper.ExecuteNonQuery(_connection, StoredProcedures.sp_DeleteMainSkill,
                                                      param);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
Exemplo n.º 17
0
        public int SaveUserAccount(UserAccount userAccount)
        {
            int success = 0;

            try
            {
                object[] param = null;
                success = SqlDBHelper.ExecuteNonQuery(_connection, StoredProcedures.sp_CreateUserAccount,
                                                      param);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
Exemplo n.º 18
0
        public bool StudentInfoInsert(StudentInfoObj StudentInformation)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Name", StudentInformation.Name),
                new SqlParameter("@ID", StudentInformation.ID),
                new SqlParameter("@Dept", StudentInformation.Dept),
                new SqlParameter("@Gender", StudentInformation.Gender),
                new SqlParameter("@CompletedCredit", StudentInformation.Completedcredit),
                new SqlParameter("@Semester", StudentInformation.Semester),
                new SqlParameter("@Cgpa", StudentInformation.Cgpa),
                new SqlParameter("@Password", StudentInformation.Password),
            };

            return(SqlDBHelper.ExecuteNonQuery("StudentInfoInsert", CommandType.StoredProcedure, parameters));
        }
Exemplo n.º 19
0
        public bool InsertQuestion(QuestionObj question)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@ExamTopic", question.ExamTopic),
                new SqlParameter("@ExamNumber", question.ExamNumber),
                new SqlParameter("@QuestionNumber", question.QuestionNumber),
                new SqlParameter("@QuestionText", question.QuestionText),
                new SqlParameter("@Option1", question.Option1),
                new SqlParameter("@Option2", question.Option2),
                new SqlParameter("@Option3", question.Option3),
                new SqlParameter("@Option4", question.Option4),
                new SqlParameter("@CorrectAnswer", question.CorrectAnswer)
            };

            return(SqlDBHelper.ExecuteNonQuery("QuestionInsert", CommandType.StoredProcedure, parameters));
        }
Exemplo n.º 20
0
        public int SaveMainSkill(MainSkill mainSkill)
        {
            int success = 0;

            try
            {
                object[] param = { mainSkill.MainSkillName,
                                   mainSkill.MainSkillDesctiption,
                                   mainSkill.Active,
                                   mainSkill.CreatedBy };
                success = SqlDBHelper.ExecuteNonQuery(_connection, StoredProcedures.sp_CreateMainSkill,
                                                      param);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
Exemplo n.º 21
0
        private static bool UpdateTicketStatus(string gid, int status)
        {
            bool        result             = false;
            SqlDBHelper dbHelper           = new SqlDBHelper();
            string      updateStatusSqlTxt = String.Format(UpdateTicketStatusSqlCmd, status, gid);

            try
            {
                if (dbHelper.ExecuteNonQuery(updateStatusSqlTxt) > 0)
                {
                    result = true;
                }
            }
            catch
            {
            }
            return(result);
        }
Exemplo n.º 22
0
        public bool AddNewClient(string teamId, string client, string jobCode, string corePlatform, string clientCode, string createdBy)
        {
            bool result;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@teamId", teamId),
                new SqlParameter("@client", client),
                new SqlParameter("@jobCode", jobCode),
                new SqlParameter("@corePlatform", corePlatform),
                new SqlParameter("@clientCode", clientCode),
                new SqlParameter("@createdBy", createdBy),
                new SqlParameter("@createdOn", DateTime.Now),
                new SqlParameter("@status", "1")
            };

            sQuery = "insert into RTM_Client_List (CL_TeamId, CL_ClientName, CL_CreatedOn, CL_Status, CL_TSheetClient, CL_Product, CL_Code, CL_CreatedBy) values (@teamId, @client, @createdOn, @status, @jobCode, @corePlatform, @clientCode, @createdBy)";
            result = objDB.ExecuteNonQuery(sQuery, CommandType.Text, parameters);
            return(result);
        }
Exemplo n.º 23
0
        public bool SaveIcon(List <IconBKInfo> iconList, string strSql)
        {
            SqlDBHelper sqlHelper = new SqlDBHelper();

            sqlHelper.BeginTran();
            try
            {
                sqlHelper.InsertOrUpdateTList <IconBKInfo>(iconList);
                sqlHelper.ExecuteNonQuery(strSql);
                sqlHelper.CommitTran();
                //sqlHelper.RollBackTran(); /////////////////////////////////////////////////////////////////////////////////
                return(true);
            }
            catch (Exception ex)
            {
                sqlHelper.RollBackTran();
                throw ex;
            }
        }
Exemplo n.º 24
0
        public ResultInfo SaveIcon(List <HQSadDTICONInfo> sadDTIconList)
        {
            _sqlHelper.BeginTran();
            try
            {
                foreach (HQSadDTICONInfo sadDTIcon in sadDTIconList)
                {
                    List <SqlParameter> pars = new List <SqlParameter>();
                    pars.Add(SqlDBHelper.GetPar("Storenum", SqlDbType.NVarChar, sadDTIcon.Storenum));
                    pars.Add(SqlDBHelper.GetPar("IconNumber", SqlDbType.NVarChar, sadDTIcon.IconNumber));
                    pars.Add(SqlDBHelper.GetPar("effective_Date", SqlDbType.DateTime, sadDTIcon.effective_Date));
                    pars.Add(SqlDBHelper.GetPar("strgroup", SqlDbType.Int, sadDTIcon.strgroup));
                    pars.Add(SqlDBHelper.GetPar("upd_seq", SqlDbType.Int, sadDTIcon.upd_seq));
                    pars.Add(SqlDBHelper.GetPar("IconName", SqlDbType.NVarChar, sadDTIcon.IconName));
                    pars.Add(SqlDBHelper.GetPar("Status", SqlDbType.Bit, sadDTIcon.Status));
                    pars.Add(SqlDBHelper.GetPar("UpUser", SqlDbType.Int, sadDTIcon.UpUser));
                    pars.Add(SqlDBHelper.GetPar("UpDT", SqlDbType.DateTime, sadDTIcon.UpDT));
                    pars.Add(SqlDBHelper.GetPar("Editor", SqlDbType.NVarChar, sadDTIcon.Editor));
                    pars.Add(SqlDBHelper.GetPar("IconType", SqlDbType.Int, sadDTIcon.IconType));
                    pars.Add(SqlDBHelper.GetPar("deleted", SqlDbType.VarChar, sadDTIcon.deleted));

                    string cmdStr = string.Format(@"
                    DELETE FROM _upd_sadDTICON WHERE Storenum=@Storenum AND IconNumber=@IconNumber AND effective_Date=@effective_Date AND strgroup=@strgroup ;
                    INSERT INTO _upd_sadDTICON(
                    [upd_seq],[Storenum],[IconNumber],[IconName],[Status],[effective_Date],[UpUser],[UpDT],[Editor],[IconType],[strgroup],[deleted]
                    ) 
                    VALUES(
                    @upd_seq,@Storenum,@IconNumber,@IconName,@Status,@effective_Date,@UpUser,@UpDT,@Editor,@IconType,@strgroup,@deleted
                    ) ;"
                                                  );
                    _sqlHelper.ExecuteNonQuery(cmdStr, pars.ToArray());
                }

                _sqlHelper.CommitTran();
                return(ResultInfo.Success);
            }
            catch (Exception ex)
            {
                _sqlHelper.RollBackTran();
                return(ResultInfo.Fail);
            }
        }
Exemplo n.º 25
0
        public bool InsertResult(ResultObj res)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@StudentID", res.StudentID),
                new SqlParameter("@ExamTopic", res.ExamTopic),
                new SqlParameter("@ExamNumber", res.ExamNumber),
                new SqlParameter("@QuestionNumber", res.QuestionNumber),
                new SqlParameter("@QuestionText", res.QuestionText),
                new SqlParameter("@Option1", res.Option1),
                new SqlParameter("@Option2", res.Option2),
                new SqlParameter("@Option3", res.Option3),
                new SqlParameter("@Option4", res.Option4),
                new SqlParameter("@CorrectAnswer", res.CorrectAnswer),
                new SqlParameter("@YourAnswer", res.YourAnswer),
                new SqlParameter("@Result", res.Result)
            };

            return(SqlDBHelper.ExecuteNonQuery("ResultInsert", CommandType.StoredProcedure, parameters));
        }
Exemplo n.º 26
0
        public bool UpdateProfile(string gender, string UserName, string emailId)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@UL_Gender", gender),
                new SqlParameter("@UL_User_Name", UserName),
                new SqlParameter("@UL_EmailId", emailId)
            };


            bool        result;
            SqlDBHelper objDB  = new SqlDBHelper();
            string      sQuery = "UPDATE RTM_User_List SET UL_EmailId=@UL_EmailId, UL_Gender=@UL_Gender WHERE UL_System_User_Name = @UL_User_Name";

            result = objDB.ExecuteNonQuery(sQuery, CommandType.Text, parameters);
            // string sQuery = "UPDATE RTM_User_List SET UL_EmailId='" + emailId + "', UL_Gender='" + gender + "' WHERE UL_System_User_Name = '"+ UserName +"'";

            //result = objDB.DBExecuteNoNQuery(sQuery);

            return(result);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 添加一个团购单
        /// </summary>
        /// <param name="ticket"></param>
        /// <returns></returns>
        public static bool AddGroupBuyTicket(GroupBuyTicketModel ticket)
        {
            bool   result = false;
            string sqlCmd = String.Format(AddGroupBuyTicketSqlCmdTemplate,
                                          ticket.Location,
                                          ticket.Title,
                                          ticket.Img,
                                          ticket.StartDate,
                                          ticket.EndDate,
                                          ticket.ProductionTotalCount,
                                          ticket.RelatedProductSysNo,
                                          ticket.Price,
                                          ticket.CountLimit);
            SqlDBHelper dbHelper = new SqlDBHelper();

            if (dbHelper.ExecuteNonQuery(sqlCmd) > 0)
            {
                result = true;
            }
            return(result);
        }
Exemplo n.º 28
0
        public void AddLogs(string UA_Action, string UA_Table, string UA_Action_By, DateTime UA_Action_Time)
        {
            try
            {
                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("@UA_Action", UA_Action),
                    new SqlParameter("@UA_Table", UA_Table),
                    new SqlParameter("@UA_Action_By", UA_Action_By),
                    new SqlParameter("@UA_Action_Time", UA_Action_Time),
                };

                sQuery = "insert into dbo.RTM_Audit_Trail (UA_Action, UA_Table, UA_Action_By, UA_Action_Time) " +
                         "values(@UA_Action, @UA_Table, @UA_Action_By,@UA_Action_Time)";
                objDB.ExecuteNonQuery(sQuery, CommandType.Text, parameters);
            }

            catch (Exception ex)
            {
            }
        }
Exemplo n.º 29
0
        public bool UpdateImages(int ticketId, string empId)
        {
            bool result;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@ticketId", ticketId),
                new SqlParameter("@empId", empId)
            };
            string sQuery = "UPDATE RTM_Ticket_Attachments SET I_TicketId =@ticketId WHERE I_TicketId=0 and I_EmpId =@empId";

            //result = objDBL.DBExecuteNoNQuery(sQuery);
            result = objDBL.ExecuteNonQuery(sQuery, CommandType.Text, parameters);

            return(result);
        }
Exemplo n.º 30
0
        public int UpdateChildSkill(ChildSkill childSkill)
        {
            int success = 0;

            try
            {
                object[] param =
                {
                    childSkill.Id,
                    childSkill.ChildSkillName,
                    childSkill.ChildSkillDesctiption,
                    childSkill.MainSkillId,
                    childSkill.Active,
                    childSkill.CreatedBy
                };
                success = SqlDBHelper.ExecuteNonQuery(_connection, StoredProcedures.sp_UpdateChildSkill,
                                                      param);
            }
            catch (Exception ex)
            {
            }
            return(success);
        }
Exemplo n.º 31
0
        private static bool UpdateTicketInitialAllocatedQtyAndStatus(string gid, int status, int productSysNo)
        {
            bool        result = false;
            string      getInitialAllocatedQtySqlTxt = String.Format(GetInitialAllocatedQtySqlCmd, productSysNo);
            SqlDBHelper dbHelper = new SqlDBHelper();

            try
            {
                DataTable data1 = dbHelper.ExecuteQuery(getInitialAllocatedQtySqlTxt);
                if (data1.Rows.Count > 0)
                {
                    int    initialAllocatedQty             = int.Parse(data1.Rows[0]["saledBefore"].ToString());
                    string updateInitialAllocatedQtySqlTxt = String.Format(UpdateInitialAllocatedQtyAndStatusSqlCmd, status, initialAllocatedQty, gid);
                    if (dbHelper.ExecuteNonQuery(updateInitialAllocatedQtySqlTxt) > 0)
                    {
                        result = true;
                    }
                }
            }
            catch
            {
            }
            return(result);
        }
Exemplo n.º 32
0
        private static bool UpdateTicketStatus(string gid, int status)
        {
            bool result = false;
            SqlDBHelper dbHelper = new SqlDBHelper();
            string updateStatusSqlTxt = String.Format(UpdateTicketStatusSqlCmd, status, gid);
            try
            {
                if (dbHelper.ExecuteNonQuery(updateStatusSqlTxt) > 0)
                {
                    result = true;
                }
            }
            catch
            {

            }
            return result;
        }
Exemplo n.º 33
0
        private static bool UpdateTicketInitialAllocatedQtyAndStatus(string gid, int status, int productSysNo)
        {
            bool result = false;
            string getInitialAllocatedQtySqlTxt = String.Format(GetInitialAllocatedQtySqlCmd, productSysNo);
            SqlDBHelper dbHelper = new SqlDBHelper();
            try
            {
                DataTable data1 = dbHelper.ExecuteQuery(getInitialAllocatedQtySqlTxt);
                if (data1.Rows.Count > 0)
                {
                    int initialAllocatedQty = int.Parse(data1.Rows[0]["saledBefore"].ToString());
                    string updateInitialAllocatedQtySqlTxt = String.Format(UpdateInitialAllocatedQtyAndStatusSqlCmd, status, initialAllocatedQty, gid);
                    if (dbHelper.ExecuteNonQuery(updateInitialAllocatedQtySqlTxt) > 0)
                    {
                        result = true;
                    }
                }
            }
            catch
            {

            }
            return result;
        }
Exemplo n.º 34
0
 /// <summary>
 /// 添加一个团购单
 /// </summary>
 /// <param name="ticket"></param>
 /// <returns></returns>
 public static bool AddGroupBuyTicket(GroupBuyTicketModel ticket)
 {
     bool result = false;
     string sqlCmd = String.Format(AddGroupBuyTicketSqlCmdTemplate,
         ticket.Location,
         ticket.Title,
         ticket.Img,
         ticket.StartDate,
         ticket.EndDate,
         ticket.ProductionTotalCount,
         ticket.RelatedProductSysNo,
         ticket.Price,
         ticket.CountLimit);
     SqlDBHelper dbHelper = new SqlDBHelper();
     if (dbHelper.ExecuteNonQuery(sqlCmd) > 0)
     {
         result = true;
     }
     return result;
 }