Exemplo n.º 1
0
        public static string INSERTANDUPDATEBANKDETAILS(string BankID, string BankName, string ZoneName, string BranchName, string City, string Empanelmentdate, string Validupto, string ContactPerson, string CPHNumber, string BankEmailAddress, string BPHNumber, string Address, string Active, string Ranges, string OTSRanges)
        {
            try
            {
                string[] NormalRange = Ranges.Split(';');
                string[] OTSRange    = OTSRanges.Split(';');

                DataTable NORMALDT = new DataTable();
                NORMALDT.Columns.Add("ID", typeof(int));
                NORMALDT.Columns.Add("RANGE_START", typeof(decimal));
                NORMALDT.Columns.Add("RANGE_END", typeof(decimal));
                NORMALDT.Columns.Add("PERCENTAGE", typeof(decimal));
                foreach (string STR in NormalRange)
                {
                    DataRow NORMALDT_NEWROW = NORMALDT.NewRow();
                    if (STR.Split(',')[0] != string.Empty)
                    {
                        NORMALDT_NEWROW["ID"] = STR.Split(',')[0];
                    }
                    else
                    {
                        return("Please Enter Valid Normal Range.");
                    }

                    if (STR.Split(',')[1] != string.Empty)
                    {
                        NORMALDT_NEWROW["RANGE_START"] = STR.Split(',')[1];
                    }
                    else
                    {
                        return("Please Enter Valid Normal Range Of Start Range.");
                    }

                    if (STR.Split(',')[2] != string.Empty)
                    {
                        NORMALDT_NEWROW["RANGE_END"] = STR.Split(',')[2];
                    }
                    else
                    {
                        return("Please Enter Valid Normal Range Of End Range.");
                    }

                    if (STR.Split(',')[3] != string.Empty)
                    {
                        NORMALDT_NEWROW["PERCENTAGE"] = STR.Split(',')[3];
                    }
                    else
                    {
                        return("Please Enter Valid Normal Range Of Percentage.");
                    }
                    NORMALDT.Rows.Add(NORMALDT_NEWROW);
                }

                DataTable OTSDT = new DataTable();
                OTSDT.Columns.Add("ID", typeof(int));
                OTSDT.Columns.Add("RANGE_START", typeof(decimal));
                OTSDT.Columns.Add("RANGE_END", typeof(decimal));
                OTSDT.Columns.Add("PERCENTAGE", typeof(decimal));


                foreach (string STR in OTSRange)
                {
                    DataRow OTSDT_NEWROW = OTSDT.NewRow();
                    if (STR.Split(',')[0] != string.Empty)
                    {
                        OTSDT_NEWROW["ID"] = STR.Split(',')[0];
                    }
                    else
                    {
                        return("Please Enter Valid OTS Range.");
                    }

                    if (STR.Split(',')[1] != string.Empty)
                    {
                        OTSDT_NEWROW["RANGE_START"] = STR.Split(',')[1];
                    }
                    else
                    {
                        return("Please Enter Valid OTS Range Of Start Range.");
                    }

                    if (STR.Split(',')[2] != string.Empty)
                    {
                        OTSDT_NEWROW["RANGE_END"] = STR.Split(',')[2];
                    }
                    else
                    {
                        return("Please Enter Valid OTS Range End Range.");
                    }

                    if (STR.Split(',')[3] != string.Empty)
                    {
                        OTSDT_NEWROW["PERCENTAGE"] = STR.Split(',')[3];
                    }
                    else
                    {
                        return("Please Enter Valid OTS Range Of Percentage.");
                    }
                    OTSDT.Rows.Add(OTSDT_NEWROW);
                }

                //Ranges = Ranges.Replace(',', '/');
                //Ranges = Ranges.Replace('.', '?');

                //OTSRanges = OTSRanges.Replace(',', '/');
                //OTSRanges = OTSRanges.Replace('.', '?');
                DataSet DT = CRBusinessLogicLayer.BANK_DETAILS_INSERT_UPDATE(BankID, BankName, ZoneName, BranchName, City, Empanelmentdate, Validupto, ContactPerson, CPHNumber, BankEmailAddress, BPHNumber, Address, Active, NORMALDT, OTSDT);
                if (DT.Tables.Count > 0)
                {
                    return(DT.Tables[0].Rows[0][0].ToString());
                }
                else
                {
                    return("");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }