protected void saveButton_Click(object sender, EventArgs e) { try { if (saveButton.Text == "Save") { LC_Composition aLC_Composition = new LC_Composition(); aLC_Composition.Composition = CompositionTextBox.Text; aLC_Composition.CreateUser = ((SessionUser)Session["SessionUser"]).UserId; aLC_Composition.CreateDate = DateTime.Now; aLC_Composition.OCode = ((SessionUser)Session["SessionUser"]).OCode; int result = aCompositionBLL.SaveData(aLC_Composition); 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_Composition aLC_Composition = new LC_Composition(); aLC_Composition.Composition = CompositionTextBox.Text; aLC_Composition.EditUser = ((SessionUser)Session["SessionUser"]).UserId; aLC_Composition.EditDate = DateTime.Now; aLC_Composition.OCode = ((SessionUser)Session["SessionUser"]).OCode; int idForUpdate = Convert.ToInt32(compositionHiddenField.Value); int result = aCompositionBLL.UpdateData(aLC_Composition, 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; } CompositionTextBox.Text = ""; LoadAllCompositionType(); saveButton.Text = "Save"; }
internal int SaveData(LC_Composition aLC_Composition) { try { _Context.LC_Composition.AddObject(aLC_Composition); _Context.SaveChanges(); return(1); } catch (Exception ex) { throw ex; } }
internal LC_Composition GetCompositionId(string compositionName) { try { LC_Composition aLC_Composition = (from p in _Context.LC_Composition where p.Composition == compositionName select p).FirstOrDefault(); return(aLC_Composition); } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } }
internal LC_Composition GetSingleData(int entryId) { try { LC_Composition aLC_Composition = new LC_Composition(); aLC_Composition = (from IName in _Context.LC_Composition where IName.Id == entryId select IName).SingleOrDefault(); return(aLC_Composition); } catch (Exception) { throw; } }
protected void imgButtonEidt_Click(object sender, ImageClickEventArgs e) { ImageButton imgbtn = (ImageButton)sender; GridViewRow row = (GridViewRow)imgbtn.NamingContainer; Label lblID = (Label)CompositionInfo.Rows[row.RowIndex].FindControl("lblID"); int entryId = Convert.ToInt32(lblID.Text); LC_Composition aLC_Composition = new LC_Composition(); aLC_Composition = aCompositionBLL.GetSingleData(entryId); compositionHiddenField.Value = aLC_Composition.Id.ToString(); CompositionTextBox.Text = aLC_Composition.Composition; saveButton.Text = "Update"; }
protected void compostionSearchTextBox_TextChanged(object sender, EventArgs e) { //[LC_YarnCostShowByComposition] string OCODE = ((SessionUser)Session["SessionUser"]).OCode; Guid createUser = ((SessionUser)Session["SessionUser"]).UserId; string compositionName = compostionSearchTextBox.Text; LC_Composition aLC_Composition = new LC_Composition(); aLC_Composition = aYarnCountDeterminationBLL.GetCompositionId(compositionName); int compositionId = aLC_Composition.Id; List <YarnDeterminationShowRepo> aYarnDeterminationShowRepo = aYarnCountDeterminationBLL.GetAllInformationOfGridViewByComposition(OCODE, compositionId, createUser); YarnDeterminationGridView.DataSource = aYarnDeterminationShowRepo; YarnDeterminationGridView.DataBind(); }
internal int UpdateData(LC_Composition aLC_Composition, int idForUpdate) { try { LC_Composition LC_Composition = _Context.LC_Composition.First(x => x.Id == idForUpdate); LC_Composition.Composition = aLC_Composition.Composition; LC_Composition.EditUser = aLC_Composition.EditUser; LC_Composition.EditDate = aLC_Composition.EditDate; LC_Composition.OCode = aLC_Composition.OCode; _Context.SaveChanges(); return(1); } catch (Exception) { throw; } }
internal int UpdateData(LC_Composition aLC_Composition, int idForUpdate) { return(aCompositionDAL.UpdateData(aLC_Composition, idForUpdate)); }
internal int SaveData(LC_Composition aLC_Composition) { return(aCompositionDAL.SaveData(aLC_Composition)); }