示例#1
0
        /// <summary>
        /// To Update details of Route in Routes table
        /// Created By : NirmalShah, 26-11-2015
        /// Modified By :
        /// </summary>
        /// <param name="objRouteBO"></param>
        /// <returns></returns>
        public ApplicationResult Route_Update(RouteBo objRouteBO)
        {
            try
            {
                pSqlParameter = new SqlParameter[7];


                pSqlParameter[0]           = new SqlParameter("@Id", SqlDbType.Int);
                pSqlParameter[0].Direction = ParameterDirection.Input;
                pSqlParameter[0].Value     = objRouteBO.Id;

                pSqlParameter[1]           = new SqlParameter("@RouteNo", SqlDbType.VarChar);
                pSqlParameter[1].Direction = ParameterDirection.Input;
                pSqlParameter[1].Value     = objRouteBO.RouteNo;

                pSqlParameter[2]           = new SqlParameter("@RouteName", SqlDbType.NVarChar);
                pSqlParameter[2].Direction = ParameterDirection.Input;
                pSqlParameter[2].Value     = objRouteBO.RouteName;

                pSqlParameter[3]           = new SqlParameter("@PLCValue", SqlDbType.Real);
                pSqlParameter[3].Direction = ParameterDirection.Input;
                pSqlParameter[3].Value     = objRouteBO.PLCValue;

                pSqlParameter[4]           = new SqlParameter("@Description", SqlDbType.NVarChar);
                pSqlParameter[4].Direction = ParameterDirection.Input;
                pSqlParameter[4].Value     = objRouteBO.Description;

                pSqlParameter[5]           = new SqlParameter("@LastModifiedBy", SqlDbType.Int);
                pSqlParameter[5].Direction = ParameterDirection.Input;
                pSqlParameter[5].Value     = objRouteBO.LastModifiedBy;

                pSqlParameter[6]           = new SqlParameter("@LastModifiedDate", SqlDbType.DateTime);
                pSqlParameter[6].Direction = ParameterDirection.Input;
                pSqlParameter[6].Value     = objRouteBO.LastModifiedDate;


                sSql = "usp_tbl_Routes_Update";
                DataTable dtResult = new DataTable();
                dtResult = Database.ExecuteDataTable(CommandType.StoredProcedure, sSql, pSqlParameter);
                ApplicationResult objResults = new ApplicationResult(dtResult);
                objResults.Status = ApplicationResult.CommonStatusType.Success;
                return(objResults);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objRouteBO = null;
            }
        }
示例#2
0
 protected void btnSave_OnClick(object sender, EventArgs e)
 {
     try
     {
         RouteBo objRouteBo = new RouteBo();
         RouteBl objRouteBl = new RouteBl();
         objRouteBo.RouteNo     = (txtRouteNo.Text.Trim());
         objRouteBo.RouteName   = txtRouteName.Text.Trim();
         objRouteBo.Description = txtDescription.Text.Trim();
         objRouteBo.PLCValue    = Convert.ToInt32(txtPLCValue.Text);
         if (ViewState["Mode"].ToString() == "Save")
         {
             objRouteBo.CreatedBy   = Convert.ToInt32(Session[ApplicationSession.Userid]);
             objRouteBo.CreatedDate = DateTime.UtcNow.AddHours(5.5);
             var objResult = objRouteBl.Route_Insert(objRouteBo);
             if (objResult != null)
             {
                 if (objResult.ResultDt.Rows.Count > 0)
                 {
                     int intStatus = Convert.ToInt32(objResult.ResultDt.Rows[0]["Status"].ToString());
                     if (intStatus == 0)
                     {
                         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Route Name or Route No is already exist.');</script>");
                     }
                     else
                     {
                         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Saved Successfully.');</script>");
                         ClearAll();
                         BindgvRoute();
                         PanelVisibilityMode(true, false);
                     }
                 }
             }
         }
         else if (ViewState["Mode"].ToString() == "Edit")
         {
             objRouteBo.LastModifiedBy   = Convert.ToInt32(Session[ApplicationSession.Userid]);
             objRouteBo.LastModifiedDate = DateTime.UtcNow.AddHours(5.5);
             objRouteBo.Id = Convert.ToInt32(ViewState["RouteID"].ToString());
             var objResult = objRouteBl.Route_Update(objRouteBo);
             if (objResult != null)
             {
                 if (objResult.ResultDt.Rows.Count > 0)
                 {
                     int intStatus = Convert.ToInt32(objResult.ResultDt.Rows[0]["Status"].ToString());
                     if (intStatus == 0)
                     {
                         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Route Name or Route No is already exist.');</script>");
                     }
                     else
                     {
                         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Updated Successfully.');</script>");
                         ClearAll();
                         BindgvRoute();
                         PanelVisibilityMode(true, false);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         log.Error("Error", ex);
         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical Problem. Contact to your Administrator.');</script>");
     }
 }