protected void btnSubmit_Click(object sender, EventArgs e) { if (this.hdnAction.Value == "") { if (!ServerValidateAll()) { this.lblStatusMessage.Text = sb.ToString(); this.programmaticModalPopup.Show(); return; } } else if (this.hdnAction.Value == "M") { if (!ServerValidateMaster()) { this.lblStatusMessage.Text = sb.ToString(); this.programmaticModalPopup.Show(); return; } } string ext = System.IO.Path.GetExtension(this.fupAttachment.FileName); if (ext == "pdf" || ext == "jpeg" || ext == "jpg" || ext == "gif") { this.lblStatusMessage.Text = "Uploaded file's extention must be of 'pdf' or 'jpg' or 'jpeg' or 'gif'."; this.programmaticModalPopup.Show(); return; } ATTLibraryMaterial LM = (ATTLibraryMaterial)Session["LM_LibraryMaterial"]; LM.OrgID = int.Parse(this.ddlOrg.SelectedValue); LM.LibraryID = int.Parse(this.ddlLibrary.SelectedValue); if (this.hdnAction.Value != "M") { LM.LMaterialID = 0; } LM.LibraryMaterialType = int.Parse(this.ddlType_Rqd.SelectedValue); LM.LibraryMaterialCategory = int.Parse(this.ddlCategory_Rqd.Text); LM.CallNo = this.txtCallNo_Rqd.Text; LM.CorporateBody = this.txtCorporateBody.Text; LM.Title = this.txtTitle_Rqd.Text; LM.SeriesStatement = this.txtSeriesState.Text; LM.Note = this.txtNote.Text; LM.BoardSubjectHeading = this.txtBrdSubHeading.Text; LM.GeoDescription = this.txtGeoDescription.Text; LM.LanguageID = int.Parse(this.ddlLanguage_Rqd.SelectedValue); LM.PublisherID = int.Parse(this.ddlPublisher_Rqd.SelectedValue); LM.PhysicalDescription = this.txtPhyDescription.Text; LM.EntryBy = ((ATTUserLogin)Session["Login_User_Detail"]).UserName; LM.EntryOn = DateTime.Now; //LM.ContentFile = null; //LM.CFileType = ""; if (this.hdnAction.Value == "M") { LM.Action = "M"; } else { LM.Action = "A"; } if (this.fupAttachment.HasFile == true) { LM.ContentFile = this.fupAttachment.FileBytes; LM.CFileType = System.IO.Path.GetExtension(this.fupAttachment.FileName); } ObjectValidation OV = BLLLibraryMaterial.Validate(LM); if (OV.IsValid == false) { //this.lblMaterialStatus.Text = OV.ErrorMessage; this.lblStatusMessage.Text = OV.ErrorMessage; this.programmaticModalPopup.Show(); return; } GridViewRow keyRow; int keyRowCount = 0; bool keyChecked; foreach (ATTLibraryMaterialKeyword ky in LM.LstLMKeyword) { keyRow = this.grdKeyword.Rows[keyRowCount]; keyChecked = ((CheckBox)keyRow.FindControl("chkKeyword")).Checked; if (keyChecked == true && ky.Action == "A") { ky.Action = "N"; } else if (keyChecked == true && ky.Action == "M") { ky.Action = "D"; } else if (keyChecked == false && ky.Action == "M") { ky.Action = "N"; } keyRowCount = keyRowCount + 1; } GridViewRow authorRow; int authorRowCount = 0; bool authorChecked; foreach (ATTLibraryMaterialAuthor au in LM.LstLMAuthor) { authorRow = this.grdAuthor.Rows[authorRowCount]; authorChecked = ((CheckBox)authorRow.FindControl("chkAuthor")).Checked; if (authorChecked == true && au.Action == "A") { au.Action = "N"; } else if (authorChecked == true && au.Action == "M") { au.Action = "D"; } else if (authorChecked == false && au.Action == "M") { au.Action = "N"; } authorRowCount = authorRowCount + 1; } ATTUserLogin user = ((ATTUserLogin)Session["Login_User_Detail"]); try { if (LM.Action == "A") { if (user.MenuList["4,9,1"] == null || user.MenuList["4,9,1"].PAdd == "N") { this.lblStatusMessage.Text = Utilities.PreviledgeMsg + " add Library Material."; this.programmaticModalPopup.Show(); return; } } else if (LM.Action == "M") { if (user.MenuList["4,9,1"] == null || user.MenuList["4,9,1"].PEdit == "N") { this.lblStatusMessage.Text = Utilities.PreviledgeMsg + " update Library Material."; this.programmaticModalPopup.Show(); return; } } Previlege.PrevilegeType pType = Previlege.PrevilegeType.P_ADD; string modeName = ""; if (LM.Action == "A") { pType = Previlege.PrevilegeType.P_ADD; modeName = "added"; } else if (LM.Action == "M") { pType = Previlege.PrevilegeType.P_EDIT; modeName = "updated"; } Previlege pobj = new Previlege(user.UserName, "4,9,1", 4, pType); Session["LM"] = LM; //save details //save master detail every time if (Session["LibMatID"] == null) { LM.Action = "A"; } else { LM.Action = "M"; LM.LMaterialID = long.Parse(Session["LibMatID"].ToString()); } long LMID = BLLLibraryMaterial.AddLibraryMaterial(LM, pobj); Session["LibMatID"] = LMID; if (this.hdnAction.Value == "M") { if (this.libMatCopyGrd.SelectedIndex > -1) { SaveLibraryDetails(LMID, "M", long.Parse(Session["AccessionID"].ToString())); LoadLibraryMaterialCopyGrid(LMID); } else if (this.libMatCopyGrd.SelectedIndex < 0) { if (this.editionTxt.Text != "" && this.pubDateTxt.Text != "" && this.priceTxt.Text != "" && this.isbnTxt.Text != "") { SaveLibraryDetails(LMID, "A", 0); LoadLibraryMaterialCopyGrid(LMID); } } } else if (this.hdnAction.Value != "M") { if (this.libMatCopyGrd.SelectedIndex > -1) { //update the material copy SaveLibraryDetails(LMID, "M", long.Parse(Session["AccessionID"].ToString())); LoadLibraryMaterialCopyGrid(LMID); } else if (this.libMatCopyGrd.SelectedIndex < 0) { //add new material copy SaveLibraryDetails(LMID, "A", 0); LoadLibraryMaterialCopyGrid(LMID); } } this.ClearLibraryMaterialControl(); this.ClearLMCopyControls(); this.LoadRegDate(); this.lblStatusMessage.Text = "Library material " + modeName + " successfully."; this.programmaticModalPopup.Show(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); return; } }
public static bool HasPrevilege(string username, Previlege.PrevilegeType PType, string menuname) { return(false); }