private bool Check() { DataSet Ds = new DataSet(); Flag = true; if (ViewState["EditID"] != null) { Ds = Obj_PM.ChkDuplicate(TxtPartyName.Text.Trim(), long.Parse(ViewState["EditID"].ToString()), out StrError); } else { Ds = Obj_PM.ChkDuplicate(TxtPartyName.Text.Trim(), -1, out StrError); } if (Ds.Tables.Count > 0) { if (Ds.Tables[0].Rows.Count > 0) { if (long.Parse(Ds.Tables[0].Rows[0][0].ToString()) > 0) { Flag = false; Obj_Comm.ShowPopUpMsg("This Party Already Exist....!", this.Page); TxtPartyName.Focus(); } } } return(Flag); }
//User Right Function=========== //public void CheckUserRight() //{ // FlagAdd = FlagDel = FlagEdit = false; // try // { // #region [USER RIGHT] // //Checking Session Varialbels======== // if (Session["UserName"] != null && Session["UserRole"] != null) // { // //Checking User Role======== // //if (!Session["UserRole"].Equals("Administrator")) // //{ // //Checking Right of users======= // System.Data.DataSet dsChkUserRight = new System.Data.DataSet(); // System.Data.DataSet dsChkUserRight1 = new System.Data.DataSet(); // dsChkUserRight1 = (DataSet)Session["DataSet"]; // DataRow[] dtRow = dsChkUserRight1.Tables[1].Select("FormName ='Party Master'"); // if (dtRow.Length > 0) // { // DataTable dt = dtRow.CopyToDataTable(); // dsChkUserRight.Tables.Add(dt);// = dt.Copy(); // } // if (Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["ViewAuth"].ToString()) == false && Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["AddAuth"].ToString()) == false && // Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["DelAuth"].ToString()) == false && Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["EditAuth"].ToString()) == false) // { // Response.Redirect("~/Masters/NotAuthUser.aspx"); // } // //Checking View Right ======== // if (Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["ViewAuth"].ToString()) == false) // { // GrdReport.Visible = false; // } // //Checking Add Right ======== // if (Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["AddAuth"].ToString()) == false) // { // BtnSave.Visible = false; // FlagAdd = true; // } // //Checking Print Right ======== // if (Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["PrintAuth"].ToString()) == false) // { // } // //Edit /Delete Column Visible ======== // if (Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["DelAuth"].ToString()) == false && Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["EditAuth"].ToString()) == false) // { // BtnDelete.Visible = false; // BtnUpdate.Visible = false; // FlagDel = true; // FlagEdit = true; // } // else // { // //Checking Delete Right ======== // if (Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["DelAuth"].ToString()) == false) // { // BtnDelete.Visible = false; // FlagDel = true; // } // //Checking Edit Right ======== // if (Convert.ToBoolean(dsChkUserRight.Tables[0].Rows[0]["EditAuth"].ToString()) == false) // { // BtnUpdate.Visible = false; // FlagEdit = true; // } // } // dsChkUserRight.Dispose(); // // } // } // else // { // Response.Redirect("~/Default.aspx"); // } // #endregion // } // catch (ThreadAbortException) // { // } // catch (Exception ex) // { // throw new Exception(ex.Message); // } //} //User Right Function=========== private void MakeEmptyForm() { TxtPartyName.Focus(); if (!FlagAdd) { BtnSave.Visible = true; } BtnUpdate.Visible = false; BtnDelete.Visible = false; BtnCancel.Visible = true; TxtPartyName.Text = string.Empty; TxtAddress.Text = string.Empty; TxtPhoneNo.Text = string.Empty; TxtEmail.Text = string.Empty; TxtSearch.Text = string.Empty; TxtWebsite.Text = string.Empty; TxtNoteC.Text = string.Empty; txtContPerName.Text = string.Empty; txtContPerAddress.Text = string.Empty; txtContPerEId.Text = string.Empty; txtContPerTelNo.Text = string.Empty; txtContPerMobNo.Text = string.Empty; TxtGSTINNo.Text = string.Empty; TxtPANNo.Text = string.Empty; TxtAdharNo.Text = string.Empty; txtMobileNo.Text = string.Empty; //SetInitialRow(); ReportGrid(StrCondition); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { MakeEmptyForm(); TxtPartyName.Focus(); } }
protected void TxtPartyCode_TextChanged(object sender, EventArgs e) { try { string PartyCode = TxtPartyCode.Text.Trim().Split(Constants.splitseperator)[0].ToString().Trim(); bool Auth = Masters.GetCodeValidation("Party", PartyCode); if (Auth) { MessageBox("Party Code Already Exist"); TxtPartyCode.Text = ""; TxtPartyCode.Focus(); } else { TxtPartyName.Focus(); } } catch { } }
protected void GrdReport_ItemCommand(object source, RepeaterCommandEventArgs e) { try { switch (e.CommandName) { case ("Select"): { if (Convert.ToInt32(e.CommandArgument) != 0) { ViewState["EditID"] = Convert.ToInt32(e.CommandArgument); DS = Obj_PM.GetPartyMaster(Convert.ToInt32(e.CommandArgument), out StrError); if (DS.Tables.Count > 0) { if (DS.Tables[0].Rows.Count > 0) { TxtPartyName.Text = DS.Tables[0].Rows[0]["PartyName"].ToString(); TxtAddress.Text = DS.Tables[0].Rows[0]["PartyAddress"].ToString(); TxtEmail.Text = DS.Tables[0].Rows[0]["PEmailId"].ToString(); txtMobileNo.Text = DS.Tables[0].Rows[0]["PmobileNo"].ToString(); TxtPhoneNo.Text = DS.Tables[0].Rows[0]["PTelNo"].ToString(); TxtWebsite.Text = DS.Tables[0].Rows[0]["PWebsite"].ToString(); txtContPerName.Text = DS.Tables[0].Rows[0]["ContPerName"].ToString(); txtContPerAddress.Text = DS.Tables[0].Rows[0]["ContPerAddress"].ToString(); txtContPerEId.Text = DS.Tables[0].Rows[0]["CEmailId"].ToString(); txtContPerMobNo.Text = DS.Tables[0].Rows[0]["CMobileNo"].ToString(); txtContPerTelNo.Text = DS.Tables[0].Rows[0]["CTelNo"].ToString(); TxtGSTINNo.Text = DS.Tables[0].Rows[0]["GSTNo"].ToString(); TxtPANNo.Text = DS.Tables[0].Rows[0]["PANNO"].ToString(); TxtAdharNo.Text = DS.Tables[0].Rows[0]["CAdharCardNo"].ToString(); TxtNoteC.Text = DS.Tables[0].Rows[0]["Note"].ToString(); } else { MakeEmptyForm(); } } DS = null; Obj_PM = null; BtnSave.Visible = false; if (!FlagEdit) { BtnUpdate.Visible = true; } if (!FlagDel) { BtnDelete.Visible = true; } TxtPartyName.Focus(); } break; } } } catch (Exception ex) { throw new Exception(ex.Message); } }