예제 #1
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (saveButton.Text == "Save")
                {
                    LC_YarnCountType aLC_YarnCountType = new LC_YarnCountType();
                    aLC_YarnCountType.YarnCountType = yarnCountTypeTextBox.Text;
                    aLC_YarnCountType.CreateUser    = ((SessionUser)Session["SessionUser"]).UserId;
                    aLC_YarnCountType.CreateDate    = DateTime.Now;
                    aLC_YarnCountType.OCode         = ((SessionUser)Session["SessionUser"]).OCode;

                    int result = aYarnCountTypeBLL.SaveData(aLC_YarnCountType);

                    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_YarnCountType aLC_YarnCountType = new LC_YarnCountType();
                    aLC_YarnCountType.YarnCountType = yarnCountTypeTextBox.Text;
                    aLC_YarnCountType.EditUser      = ((SessionUser)Session["SessionUser"]).UserId;
                    aLC_YarnCountType.EditDate      = DateTime.Now;
                    aLC_YarnCountType.OCode         = ((SessionUser)Session["SessionUser"]).OCode;

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

                    int result = aYarnCountTypeBLL.UpdateData(aLC_YarnCountType, 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;
            }

            yarnCountTypeTextBox.Text = "";
            LoadAllYarnCountType();
            saveButton.Text = "Save";
        }
예제 #2
0
 internal int SaveData(LC_YarnCountType aLC_YarnCountType)
 {
     try
     {
         _Context.LC_YarnCountType.AddObject(aLC_YarnCountType);
         _Context.SaveChanges();
         return(1);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
        internal LC_YarnCountType GetSingleData(int entryId)
        {
            try
            {
                LC_YarnCountType aLC_YarnCountType = new LC_YarnCountType();

                aLC_YarnCountType = (from IName in _Context.LC_YarnCountType
                                     where IName.Id == entryId
                                     select IName).SingleOrDefault();
                return(aLC_YarnCountType);
            }
            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)yarnCountTypeInfo.Rows[row.RowIndex].FindControl("lblID");

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

            LC_YarnCountType aLC_YarnCountType = new LC_YarnCountType();

            aLC_YarnCountType = aYarnCountTypeBLL.GetSingleData(entryId);

            yarncontTypeHiddenField.Value = aLC_YarnCountType.Id.ToString();
            yarnCountTypeTextBox.Text     = aLC_YarnCountType.YarnCountType;

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



                LC_YarnCountType.YarnCountType = aLC_YarnCountType.YarnCountType;
                LC_YarnCountType.EditUser      = aLC_YarnCountType.EditUser;
                LC_YarnCountType.EditDate      = aLC_YarnCountType.EditDate;
                LC_YarnCountType.OCode         = aLC_YarnCountType.OCode;

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