예제 #1
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (saveButton.Text == "Save")
                {
                    LC_FabricNature aLC_FabricNature = new LC_FabricNature();

                    aLC_FabricNature.FabricNature = fabricNatureTextBox.Text;
                    aLC_FabricNature.CreateUser   = ((SessionUser)Session["SessionUser"]).UserId;
                    aLC_FabricNature.CreateDate   = DateTime.Now;
                    aLC_FabricNature.OCode        = ((SessionUser)Session["SessionUser"]).OCode;

                    int result = aFabricNatureBLL.SaveData(aLC_FabricNature);

                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "SuccessAlert('Save Successfully!!')", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "notsuccessalert('Not Save!!')", true);
                    }
                }
                else if (saveButton.Text == "Update")
                {
                    LC_FabricNature aLC_FabricNature = new LC_FabricNature();

                    aLC_FabricNature.FabricNature = fabricNatureTextBox.Text;
                    aLC_FabricNature.CreateUser   = ((SessionUser)Session["SessionUser"]).UserId;
                    aLC_FabricNature.CreateDate   = DateTime.Now;
                    aLC_FabricNature.OCode        = ((SessionUser)Session["SessionUser"]).OCode;

                    int idForUpdate = Convert.ToInt32(fabricNatureHiddenField.Value);


                    int result = aFabricNatureBLL.UpdateData(aLC_FabricNature, idForUpdate);

                    if (result == 1)
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "SuccessAlert('Update Successfully!!')", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Popup", "notsuccessalert('Not Update!!')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            fabricNatureTextBox.Text = "";
            LoadAllFabricNature();
        }
예제 #2
0
 internal int SaveData(LC_FabricNature aLC_FabricNature)
 {
     try
     {
         _Context.LC_FabricNature.AddObject(aLC_FabricNature);
         _Context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
        internal LC_FabricNature GetSingleData(int entryId)
        {
            try
            {
                LC_FabricNature aLC_FabricNature = new LC_FabricNature();

                aLC_FabricNature = (from IName in _Context.LC_FabricNature
                                    where IName.Id == entryId
                                    select IName).SingleOrDefault();
                return(aLC_FabricNature);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #4
0
        protected void imgButtonEidt_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton imgbtn = (ImageButton)sender;
            GridViewRow row    = (GridViewRow)imgbtn.NamingContainer;

            Label lblID = (Label)FabricNatureInfo.Rows[row.RowIndex].FindControl("lblID");

            int entryId = Convert.ToInt32(lblID.Text);

            LC_FabricNature aLC_FabricNature = new LC_FabricNature();

            aLC_FabricNature = aFabricNatureBLL.GetSingleData(entryId);

            fabricNatureHiddenField.Value = aLC_FabricNature.Id.ToString();
            fabricNatureTextBox.Text      = aLC_FabricNature.FabricNature;

            saveButton.Text = "Update";
        }
예제 #5
0
        internal int UpdateData(LC_FabricNature aLC_FabricNature, int idForUpdate)
        {
            try
            {
                LC_FabricNature LC_FabricNature = _Context.LC_FabricNature.First(x => x.Id == idForUpdate);



                LC_FabricNature.FabricNature = aLC_FabricNature.FabricNature;
                LC_FabricNature.EditUser     = aLC_FabricNature.EditUser;
                LC_FabricNature.EditDate     = aLC_FabricNature.EditDate;
                LC_FabricNature.OCode        = aLC_FabricNature.OCode;

                _Context.SaveChanges();
                return(1);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #6
0
 internal int UpdateData(LC_FabricNature aLC_FabricNature, int idForUpdate)
 {
     return(aFabricNatureDAL.UpdateData(aLC_FabricNature, idForUpdate));
 }
예제 #7
0
 internal int SaveData(LC_FabricNature aLC_FabricNature)
 {
     return(aFabricNatureDAL.SaveData(aLC_FabricNature));
 }