private void Select_Account_Name()
        {
            try
            {
                Rep_General general = new Rep_General();
                DataTable   User    = (DataTable)Session["user"];

                string userId = User.Rows[0]["UserID"].ToString();
                string accId  = "";
                if (Request.QueryString[general.ObfuscateQueryString("accID")] != null)
                {
                    string value = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();
                    accId = general.DecryptIds(int.Parse(value)).ToString();
                }
                else
                {
                    //accId = lblAccID.Text;
                }


                Rep_Account account = new Rep_Account();

                DataTable accTable = account.SelectAcc(int.Parse(userId), int.Parse(accId));

                if (accTable.Rows.Count > 0)
                {
                    accNo.Text   = accTable.Rows[0]["AccNo"].ToString();
                    accName.Text = accTable.Rows[0]["AccName"].ToString();
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
        private void Get_ContactType()
        {
            try
            {
                Rep_General general     = new Rep_General();
                Rep_Account accountUdt  = new Rep_Account();
                DataTable   User        = (DataTable)Session["user"];
                DataTable   accUdtTable = new DataTable();

                string userId = User.Rows[0]["UserID"].ToString();
                string accId  = "";
                if (Request.QueryString[general.ObfuscateQueryString("accID")] != null)
                {
                    string value = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();
                    accId       = general.DecryptIds(int.Parse(value)).ToString();
                    accUdtTable = accountUdt.SelectAcc(int.Parse(userId), int.Parse(accId));
                }
                else
                {
                }

                ddlContactType.DataSource     = SelectddlDataTable("SP_SysCode_AccContact_Type", accUdtTable.Rows[0]["AccCategory"].ToString());
                ddlContactType.DataTextField  = "ContactType";
                ddlContactType.DataValueField = "ContactTypeID";
                ddlContactType.DataBind();
                ddlContactType.Items.Insert(0, new ListItem("Select", "-1"));
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += errText;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Get_Navegation_Panel();

            if (!IsPostBack)
            {
                Generate_Buttons();
                Rep_General general = new Rep_General();

                if (Request.QueryString[general.ObfuscateQueryString("accID")] != null)
                {
                    if (hidnViewFlag.Value == "Update")
                    {
                        //hidnViewFlag.Value = "Update";
                        lblSubject.Text = "Edit";
                    }
                    else if (hidnViewFlag.Value == "Add")
                    {
                        //hidnViewFlag.Value = "Add";
                        lblSubject.Text = "New";
                    }

                    else
                    {
                        hidnViewFlag.Value = "View";
                        lblSubject.Text    = "View";



                        AccIDEnc.Value = Request.QueryString[general.ObfuscateQueryString("accID")].ToString();

                        DataTable User = Session["user"] != null ? (DataTable)Session["user"] : new DataTable();
                        if (User.Rows.Count > 0)
                        {
                            UserID.Value   = User.Rows[0]["UserID"].ToString();
                            lblAccID.Text  = general.DecryptIds(int.Parse(AccIDEnc.Value)).ToString();
                            AccIDDec.Value = lblAccID.Text;



                            string texttaccNo = Request.QueryString[general.ObfuscateQueryString("accNo")] != null
                                ? Request.QueryString[general.ObfuscateQueryString("accNo")].ToString()
                                : "";
                            accNo.Text = texttaccNo != string.Empty ? general.DecryptIds(int.Parse(texttaccNo)).ToString() : "";

                            Rep_Account account = new Rep_Account();

                            DataTable accTable = account.SelectAcc(int.Parse(UserID.Value), int.Parse(AccIDDec.Value));

                            accName.Text = accTable.Rows.Count > 0 ? accTable.Rows[0]["AccName"].ToString() : string.Empty;


                            FillDDLs();

                            FillAccountSales(GetAccountSales());
                        }
                        else
                        {
                            B_11_OnClick(null, null);
                        }
                    }


                    //get Roles after check the flag value
                    Btn_Fields_Roles();
                    DisableEdit();
                }
                else
                {
                    B_11_OnClick(null, null);
                }
            }
            else
            {
                // FillAccountInfoGRD();
            }
        }