示例#1
0
        protected void panel_lnkCrdtInfo_OnClick(object sender, EventArgs e)
        {
            Rep_General general = new Rep_General();

            try
            {
                DataTable user = (DataTable)Session["user"];

                int userId = int.Parse(user.Rows[0]["UserID"].ToString());

                string module = general.SelectModule(userId, "AccountCrdt");
                if (module != "Stop")
                {
                    int accId    = int.Parse(AccIDEnc.Value);
                    int accNoTXT = general.EncryptIds(int.Parse(accNo.Text));
                    Response.Redirect("~/Modules/" + module + ".aspx?" + general.ObfuscateQueryString("accID") + "=" + accId + "&" + general.ObfuscateQueryString("accNo") + "=" + accNoTXT + "", false);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", "Access Denied"), true);
                }
            }
            catch (Exception ex)
            {
                string error   = ex.Message;
                string errText = error.Replace("\'", "");

                string AlertMSG = "";
                AlertMSG += error;
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
            }
        }
        protected void CustomersGRD_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "EditCommand")
            {
                //string strKey = e.CommandArgument.ToString();
                string strr = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["AccID"].ToString();
                //Response.Redirect("~/Modules/Account/AccountAdd.aspx?ARXDWB=" + strr + "");

                try
                {
                    Rep_General accountSearch = new Rep_General();
                    DataTable   user          = (DataTable)Session["user"];

                    int userId = int.Parse(user.Rows[0]["UserID"].ToString());

                    string module = accountSearch.SelectModule(userId, "AccountAdd");
                    if (module != "Stop")
                    {
                        int accId = accountSearch.EncryptIds(int.Parse(strr));
                        Response.Redirect("~/Modules/" + module + ".aspx?" + accountSearch.ObfuscateQueryString("accID") + "=" + accId + "");
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", "Access Denied"), true);
                    }
                }
                catch (Exception ex)
                {
                    string error   = ex.Message;
                    string errText = error.Replace("\'", "");

                    string AlertMSG = "";
                    AlertMSG += error;
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
                }
            }

            #region Link
            else if (e.CommandName == "LinkCommand")
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("ShowconfirmDialog();"), true);
                lblAccId.Text = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["AccID"].ToString();
            }
            #endregion Link

            #region Refresh Grid
            else if (e.CommandName == "RebindGrid")
            {
                SearchBTN_Click(null, null);
            }
            #endregion Refresh Grid


            #region Else
            else
            {
                SearchBTN_Click(null, null);
            }
            #endregion Else
        }
        protected void panel_lnkAccSales_OnClick(object sender, EventArgs e)
        {
            Rep_General general = new Rep_General();

            foreach (GridDataItem selectinganItem in CustomersGRD.MasterTableView.Items)
            {
                if (selectinganItem.Selected)
                {
                    try
                    {
                        int accId = general.EncryptIds(int.Parse(selectinganItem["AccID"].Text));
                        int accNo = general.EncryptIds(int.Parse(selectinganItem["AccNo"].Text));

                        Rep_General accountSearch = new Rep_General();
                        DataTable   user          = (DataTable)Session["user"];

                        int userId = int.Parse(user.Rows[0]["UserID"].ToString());

                        string module = accountSearch.SelectModule(userId, "AccountSales");
                        if (module != "Stop")
                        {
                            Response.Redirect("~/Modules/" + module + ".aspx?" + general.ObfuscateQueryString("accID") + "=" + accId + "&" + general.ObfuscateQueryString("accNo") + "=" + accNo + "", false);
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", "Access Denied"), true);
                        }
                    }
                    catch (Exception ex)
                    {
                        string error   = ex.Message;
                        string errText = error.Replace("\'", "");

                        string AlertMSG = "";
                        AlertMSG += error;
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", AlertMSG), true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", string.Format("window.alert('{0}');", "Please select your record"), true);
                }
            }
        }