示例#1
0
 protected void GrdRules_RowDeleting(object sender, GridViewDeleteEventArgs e)//----------------------Row Delete (grid view: GrdRules)---------------------------//
 {
     //DataTable dt = (DataTable)GrdRules.DataSource;
     DtRules = (DataTable)Session["DtRules"];
     DtRules.Rows[e.RowIndex].Delete();
     GrdRules.DataSource = DtRules;
     GrdRules.DataBind();
 }
        protected void GrdRules_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //DataTable dt = (DataTable)GrdRules.DataSource;
            DtRules = (DataTable)Session["DtRules"];
            DtRules.Rows[e.RowIndex].Delete();
            GrdRules.DataSource = DtRules;
            GrdRules.DataBind();

            lblCount.Text = DtRules.Rows.Count.ToString();

            this.SetFocus(cmdViewRule);
        }
        protected void cmdAddRule_Click(object sender, EventArgs e)
        {
            try
            {
                if (page_result.Visible == true)
                {
                    page_result.Visible = false;
                }

                if (DDLRules.SelectedIndex == 0)
                {
                    call_error_msg(false);
                    lblResult.Text = "Please Select a Column And Try Again...!";
                    return;
                }

                //GrdRules.Columns[2].ItemStyle.HorizontalAlign = HorizontalAlign.Right;

                DtRules = (DataTable)Session["DtRules"];

                DataRow Row = DtRules.NewRow();
                Row["ID"]          = Convert.ToString(DDLRules.SelectedValue);
                Row["Description"] = Convert.ToString(DDLRules.SelectedItem);
                DtRules.Rows.Add(Row);

                GrdRules.DataSource = DtRules;
                GrdRules.DataBind();

                lblCount.Text = DtRules.Rows.Count.ToString();

                this.SetFocus(cmdViewRule);
            }
            catch (Exception ex)
            {
                CommonCLS.CommonFunctions.Logger(System.Web.VirtualPathUtility.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath), System.Reflection.MethodBase.GetCurrentMethod().Name, ex.InnerException.ToString(), Server.MapPath("~/IBTLogFiles/Log.txt"));
                call_error_msg(false);
                lblResult.Text = ex.InnerException.ToString();
            }
        }
        protected void cmdSaveRule_Click(object sender, EventArgs e)
        {
            try
            {
                //--------------Validations----------------------------
                if (ddlIBTRules.SelectedValue == "0")
                {
                    call_error_msg(false);
                    lblResult.Text = "Please Select the Rule...";
                    return;
                }
                if (ddlIbtAcc.SelectedIndex == 0)
                {
                    call_error_msg(false);
                    lblResult.Text = "Please Select the Account...";
                    return;
                }
                if (ddlTrans.SelectedValue == "0")
                {
                    call_error_msg(false);
                    lblResult.Text = "Please Select the Transaction...";
                    return;
                }
                //----------------------------------------------------

                //CommonCLS.CommonFunctions clsCom = new CommonCLS.CommonFunctions();
                string UserName = usrName;// clsCom.getCurentUser();

                String SQLWhere = "";

                if (ddlIbtAcc.SelectedIndex != 0)
                {
                    SQLWhere = SQLWhere + "ACCOUNT_NO = " + ddlIbtAcc.SelectedValue;
                }

                if (ddlTrans.SelectedIndex == 2)//Debit
                {
                    SQLWhere = SQLWhere + " AND DEBIT > 0";
                }

                if (ddlTrans.SelectedIndex == 3)//Debit
                {
                    SQLWhere = SQLWhere + " AND CREDIT > 0";
                }

                //SQLWhere = SQLWhere;

                foreach (GridViewRow row in GrdRules.Rows)
                {
                    DropDownList DDLOPENBrackets  = row.Cells[0].FindControl("ddlOpenBracket") as DropDownList;
                    TextBox      TXTColID         = row.Cells[1].FindControl("txtcolID") as TextBox;
                    TextBox      TXTColDesc       = row.Cells[2].FindControl("txtDescription") as TextBox;
                    DropDownList DDLOperator      = row.Cells[3].FindControl("ddlOperator") as DropDownList;
                    TextBox      TXTValue         = row.Cells[4].FindControl("txtValue") as TextBox;
                    DropDownList DDLCLOSEBrackets = row.Cells[4].FindControl("ddlCloseBracket") as DropDownList;
                    DropDownList DDLConditions    = row.Cells[5].FindControl("ddlConditions") as DropDownList;


                    OracleConnection OraCon = new OracleConnection(ConfigurationManager.ConnectionStrings["ORAWF"].ToString());


                    if (DDLOperator.SelectedIndex != 0)
                    {
                        OracleCommand objCmd = new OracleCommand();
                        OraCon.Open();
                        objCmd.Connection  = OraCon;
                        objCmd.CommandText = "SP_FAS_IBT_BIFURCATION_RULES";
                        objCmd.CommandType = CommandType.StoredProcedure;

                        objCmd.Parameters.Add("RULE_ID", OracleType.Number).Value          = Convert.ToInt16(ddlIBTRules.SelectedValue);
                        objCmd.Parameters.Add("OPEN_BRACKET_ID", OracleType.Number).Value  = Convert.ToInt16(DDLOPENBrackets.SelectedValue);
                        objCmd.Parameters.Add("DESCRIPTION", OracleType.VarChar).Value     = TXTColDesc.Text;
                        objCmd.Parameters.Add("ACC_ID", OracleType.VarChar).Value          = ddlIbtAcc.SelectedValue;
                        objCmd.Parameters.Add("TYPE_ID", OracleType.Number).Value          = Convert.ToInt64(ddlTrans.SelectedValue);
                        objCmd.Parameters.Add("COLUMN_ID", OracleType.Number).Value        = Convert.ToInt64(TXTColID.Text);
                        objCmd.Parameters.Add("OPERATOR_ID", OracleType.Number).Value      = Convert.ToInt64(DDLOperator.SelectedValue);
                        objCmd.Parameters.Add("VALUE", OracleType.VarChar).Value           = TXTValue.Text;
                        objCmd.Parameters.Add("CLOSE_BRACKET_ID", OracleType.Number).Value = Convert.ToInt64(DDLCLOSEBrackets.SelectedValue);

                        objCmd.Parameters.Add("CONDITION", OracleType.Number).Value = Convert.ToInt16(DDLConditions.SelectedValue);

                        SQLWhere = SQLWhere + CreateSQLWhere(SQLWhere, DDLOPENBrackets.SelectedItem.Text, TXTColDesc.Text, Convert.ToInt16(DDLOperator.SelectedValue), TXTValue.Text, DDLCLOSEBrackets.SelectedItem.Text, DDLConditions.SelectedItem.Text);

                        //objCmd.Parameters.Add("CREATEDBY", OracleType.VarChar).Value = UserName;

                        objCmd.ExecuteNonQuery();
                    }
                }

                //Rule Header Update
                OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["ORAWF"].ToString());
                conn.Open();
                OracleCommand cmd = conn.CreateCommand();

                cmd.CommandText = "SP_FAS_IBT_BIFURCATE_RULES_HDR";
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("RULE_ID", OracleType.Int32).Value       = Convert.ToInt64(ddlIBTRules.SelectedValue);
                cmd.Parameters.AddWithValue("ACC_ID", OracleType.VarChar).Value      = ddlIbtAcc.SelectedValue;
                cmd.Parameters.AddWithValue("TRANS_ID", OracleType.Int32).Value      = Convert.ToInt64(ddlTrans.SelectedValue);
                cmd.Parameters.AddWithValue("DESCRIPTION", OracleType.VarChar).Value = SQLWhere;

                cmd.Parameters.AddWithValue("CREATEDBY", OracleType.VarChar).Value = UserName;

                cmd.ExecuteNonQuery();
                conn.Close();



                ddlIbtAcc.SelectedIndex   = -1;
                ddlIBTRules.SelectedIndex = -1;
                ddlTrans.SelectedIndex    = -1;
                DDLRules.SelectedIndex    = -1;

                GrdRules.DataSource = null;
                GrdRules.DataBind();
                txtViewRule.Text = "";

                this.SetFocus(cmdViewRule);
            }
            catch (Exception ex)
            {
                CommonCLS.CommonFunctions.Logger(System.Web.VirtualPathUtility.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath), System.Reflection.MethodBase.GetCurrentMethod().Name, ex.InnerException.ToString(), Server.MapPath("~/IBTLogFiles/Log.txt"));
                call_error_msg(false);
                lblResult.Text = ex.InnerException.ToString();
            }
        }
示例#5
0
        protected void cmdSaveRule_Click(object sender, EventArgs e)//--------------------------------------Save New Rule-----------------------------------------------//
        {
            try
            {
                if ((ddlIBTRules.SelectedIndex == 0) || (ddlAllProducts.SelectedIndex == 0) || (ddlDepartment.SelectedIndex == 0))
                {
                    call_error_msg(false);
                    lblResult.Text = "IBT Rule, Product And Department Fields Are Mandentory, Please Try Again...!";
                    return;
                }
                else
                {
                    CommonCLS.CommonFunctions clsCom = new CommonCLS.CommonFunctions();
                    String UserName = usrName;// clsCom.getCurentUser();

                    String SQLWhere = "";


                    foreach (GridViewRow row in GrdRules.Rows)
                    {
                        DropDownList DDLOPENBrackets = row.Cells[0].FindControl("ddlOpenBracket") as DropDownList;
                        TextBox      TXTColID        = row.Cells[1].FindControl("txtcolID") as TextBox;
                        TextBox      TXTColDesc      = row.Cells[2].FindControl("txtDescription") as TextBox;
                        DropDownList DDLOperator     = row.Cells[3].FindControl("ddlOperator") as DropDownList;
                        TextBox      TXTValue        = row.Cells[4].FindControl("txtValue") as TextBox;
                        //DropDownList DDLPolicyDTL = row.Cells[3].FindControl("ddlPolicyDtl") as DropDownList;
                        TextBox      TXTUserInput     = row.Cells[5].FindControl("txtUsrInput") as TextBox;
                        DropDownList DDLCLOSEBrackets = row.Cells[6].FindControl("ddlCloseBracket") as DropDownList;
                        DropDownList DDLConditions    = row.Cells[7].FindControl("ddlConditions") as DropDownList;

                        if (DDLOperator.SelectedIndex != 0)
                        {
                            //SQLWhere = SQLWhere + CreateSQLWhere(SQLWhere, DDLOPENBrackets.SelectedItem.Text, TXTColDesc.Text, Convert.ToInt16(DDLOperator.SelectedValue), TXTValue.Text, DDLPolicyDTL.SelectedItem.Text, DDLCLOSEBrackets.SelectedItem.Text, DDLConditions.SelectedItem.Text, ddlDepartment.SelectedItem.Text);
                            SQLWhere = SQLWhere + CreateSQLWhere(SQLWhere, DDLOPENBrackets.SelectedItem.Text, TXTColDesc.Text, Convert.ToInt16(DDLOperator.SelectedValue), TXTValue.Text, TXTUserInput.Text, DDLCLOSEBrackets.SelectedItem.Text, DDLConditions.SelectedItem.Text, int.Parse(ddlDepartment.SelectedValue.ToString()));
                        }
                    }

                    txtViewRule.Text = SQLWhere;



                    //Rule Header Update
                    OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["ORAWF"].ToString());
                    conn.Open();

                    OracleCommand cmd = new OracleCommand();//conn.CreateCommand();
                    cmd.Connection = conn;

                    cmd.CommandText = "SP_FAS_IBT_MCPMCR_RULES_HDR";
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("RULE_ID", OracleType.Int32).Value       = Convert.ToInt32(ddlIBTRules.SelectedValue);//ToInt64
                    cmd.Parameters.AddWithValue("DESCRIPTION", OracleType.VarChar).Value = SQLWhere.ToUpper();
                    cmd.Parameters.AddWithValue("product_id", OracleType.Int32).Value    = ddlAllProducts.SelectedValue;
                    cmd.Parameters.AddWithValue("mcpmcr_value", OracleType.Int32).Value  = ddlDepartment.SelectedItem.Value;
                    cmd.Parameters.AddWithValue("vCreatedby", OracleType.VarChar).Value  = usrName;

                    cmd.ExecuteNonQuery();
                    conn.Close();

                    CommonCLS.CommonFunctions.Logger(System.Web.VirtualPathUtility.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath), System.Reflection.MethodBase.GetCurrentMethod().Name, "----New Type Of Product Rule Saved---- By: " + usrName, Server.MapPath("~/IBTLogFiles/Log.txt"));

                    call_error_msg(true);
                    lblResult.Text = "Rule Inserted Successfully...!";

                    this.SetFocus(cmdViewRule);
                    ClearInputs(Page.Controls);
                    GrdRules.DataSource = null;
                    GrdRules.DataBind();
                }
            }
            catch (Exception ex)
            {
                CommonCLS.CommonFunctions.Logger(System.Web.VirtualPathUtility.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath), System.Reflection.MethodBase.GetCurrentMethod().Name, ex.InnerException.ToString() + "---Type Of Product Rule Insertion Fail...! - Active User: "******"~/IBTLogFiles/Log.txt"));
                call_error_msg(false);
                lblResult.Text = ex.InnerException.ToString();
            }
        }
示例#6
0
        protected void cmdAddRule_Click(object sender, EventArgs e)//---------------------------------------Add New Row To The Gridview---------------------------------//
        {
            try
            {
                if (page_result.Visible == true)
                {
                    page_result.Visible = false;
                }

                call_error_msg(true);
                lblResult.Text = "";


                if (ddlIBTRules.SelectedIndex == 0)
                {
                    call_error_msg(false);
                    lblResult.Text = "Please Select A Rule And Try Again...!";
                    return;
                }
                if (ddlAllProducts.SelectedIndex == 0)
                {
                    call_error_msg(false);
                    lblResult.Text = "Please Select A Product And Try Again...!";
                    return;
                }
                if (ddlDepartment.SelectedIndex == 0)
                {
                    call_error_msg(false);
                    lblResult.Text = "Please Select A Product And Try Again...!";
                    return;
                }
                if (DDLRules.SelectedIndex == 0)
                {
                    call_error_msg(false);
                    lblResult.Text = "Please Select A Column And Try Again...!";
                    return;
                }



                //GrdRules.Columns[2].ItemStyle.HorizontalAlign = HorizontalAlign.Right;

                DtRules = (DataTable)Session["DtRules"];
                string currentDate = System.DateTime.Now.ToString();

                DataRow Row = DtRules.NewRow();
                Row["ID"]          = Convert.ToString(DDLRules.SelectedValue);
                Row["Description"] = Convert.ToString(DDLRules.SelectedItem);
                Row["CreateDate"]  = currentDate;
                DtRules.Rows.Add(Row);

                GrdRules.DataSource = DtRules;
                GrdRules.DataBind();

                CommonCLS.CommonFunctions.Logger(System.Web.VirtualPathUtility.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath), System.Reflection.MethodBase.GetCurrentMethod().Name, "----New Column Added To Grid View (GrdRules) ---- By: " + usrName, Server.MapPath("~/IBTLogFiles/Log.txt"));

                this.SetFocus(cmdViewRule);
            }
            catch (Exception ex)
            {
                CommonCLS.CommonFunctions.Logger(System.Web.VirtualPathUtility.GetFileName(System.Web.HttpContext.Current.Request.Url.AbsolutePath), System.Reflection.MethodBase.GetCurrentMethod().Name, ex.InnerException.ToString() + "Active User: "******"~/IBTLogFiles/Log.txt"));
                lblResult.Text = ex.InnerException.ToString();
            }
        }