Ejemplo n.º 1
0
 public static bool ChechRights(int UId, object RightsOn,string ColName)
 {
     bool IsRightGiven = false;
     try
     {
         string SS = "Select " + ColName + " From UserConfiguration Where U_UId = " + UId + " And U_MId = " + RightsOn.ToString() + "";
         System.Data.DataTable Dt = new ClsDataAccess().GetDataTable(SS);
         if (Dt.Rows.Count > 0)
         {
             IsRightGiven = bool.Parse(Dt.Rows[0][ColName].ToString());
         }
     }
     catch (Exception Erp)
     {
         clsGeneral.ShowErrMsg(Erp.Message);
         IsRightGiven = false;
     }
     if (IsRightGiven == false)
     {
         clsGeneral.ShowMessage("You Do not Have Rights to Access This Module");
     }
     return IsRightGiven;
 }
Ejemplo n.º 2
0
        static void Main()
        {
            try
            {
                RegistryKey key;
                key = Registry.CurrentUser.OpenSubKey("Control Panel\\International", true);

                if (key.ToString().Trim() != "")
                {
                    key.SetValue("sShortDate", "dd/MM/yyyy");
                }
            }
            catch
            {
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ClsDataAccess ObjDataAccess = new ClsDataAccess();
            bool chk_file = false;
            chk_file = System.IO.File.Exists("Finance.stl");
            if (chk_file == false)
            {
                Frm_SqlSettings sqlSetting = new Frm_SqlSettings();
                sqlSetting.ShowDialog();
            }
            else
            {
                StreamReader objReader = new StreamReader("Finance.stl");
                Program.connectionString = objReader.ReadLine();
                objReader.Close();
                objReader.Dispose();
                try
                {
                    ObjDataAccess.CreateConnection();
                }
                catch
                {
                    clsGeneral.ShowErrMsg("Error In Connection");
                    File.Delete("Finance.stl");
                    Frm_SqlSettings sqlSetting = new Frm_SqlSettings();
                    sqlSetting.ShowDialog();
                    if (sqlSetting.DialogResult == DialogResult.Yes)
                    {
                        StreamWriter SW;
                        SW = File.CreateText("Finance.stl");
                        SW.WriteLine(Program.connectionString);
                        SW.Close();
                        SW.Dispose();
                    }
                    else
                    {
                        Application.Exit();
                        return;
                    }
                }
            }

            string[] connSplit = Program.connectionString.Split(';');
            if (connSplit.Length == 6)
            {
                string[] DataSourceName = connSplit[0].Split('=');
                string[] DataBaseName = connSplit[1].Split('=');
                Program.DataBaseName = DataBaseName[1].ToString();
            }

            else if (connSplit.Length > 6)
            {
                string[] DataSourceName = connSplit[0].Split('=');
                string[] DataBaseName = connSplit[1].Split('=');
                string[] UserName = connSplit[2].Split('=');
                string[] PassWord = connSplit[3].Split('=');
                Program.DataBaseName = DataBaseName[1].ToString();
                Program.ServerName = DataSourceName[1].ToString();
                Program.ServerUserId = UserName[1].ToString();
                Program.ServerPassword = PassWord[1].ToString();
            }

            //========================================================================

            try
            {

                string SS = "Create View vw_Form13 As ";
                SS = SS + " Select '' As CompanyName,'' As Address1, ";
                SS = SS + " '' As Address2,'' As Date,'' As ContactName, ";
                SS = SS + " '' As LicenseNo,'' As SNo,'' As Debtor, ";
                SS = SS + " '' As AddressDebtor,'' As LoanAmount, ";
                SS = SS + " '' As DateLoan,'' As DateMaturity, ";
                SS = SS + " '' As Balance,'' As Rate,'' As [Security], ";
                SS = SS + " '' As Documents,'' As Information ";
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {

                string SS = "CREATE TABLE [dbo].[LoanDocuments]([DId] [int] ";
                SS = SS + " IDENTITY(1,1) NOT NULL,	[D_LId] [int] NULL,	";
                SS = SS + " [D_DId] [int] NULL, CONSTRAINT [PK_LoanDocuments] ";
                SS = SS + " PRIMARY KEY CLUSTERED ( [DId] ASC )WITH ";
                SS = SS + " (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]";
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string SS = "CREATE TABLE [ChequeDetails]( ";
                SS = SS + " [S_Id] [int] , ";
                SS = SS + " [S_SNo] [int] , ";
                SS = SS + " [S_ChequeDate] [varchar](max), ";
                SS = SS + " [S_ChequeNo] [varchar](max) ) ";
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string SS = "CREATE TABLE [dbo].[UserMaster]( ";
                SS = SS + " [UId] [int] IDENTITY(1,1) NOT NULL, ";
                SS = SS + " [UName] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, ";
                SS = SS + " [ULoginName] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, ";
                SS = SS + " [UPassword] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, ";
                SS = SS + " CONSTRAINT [PK_UserMaster] PRIMARY KEY CLUSTERED ";
                SS = SS + " ([UId] ASC)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY] ";
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string SS = "CREATE TABLE [dbo].[UserConfiguration]( ";
                SS = SS + " [U_UId] [int] NULL,[U_MId] [int] NULL, ";
                SS = SS + " [U_Save] [bit] NULL,[U_Delete] [bit] NULL, ";
                SS = SS + " [U_Print] [bit] NULL,[U_View] [bit] NULL ";
                SS = SS + " ) ON [PRIMARY] ";
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {

                string SS = "Alter Table LoanSanction ADD L_Known Varchar(Max)";
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string SS = "CREATE TABLE [dbo].[AccountForeClosure]( ";
                SS = SS + " [F_Id] [int] IDENTITY(1,1) NOT NULL, ";
                SS = SS + " [F_SId] [int] NULL, ";
                SS = SS + " [F_Date] [datetime] NULL, ";
                SS = SS + " [F_Principal] [numeric](18, 2) NULL, ";
                SS = SS + " [F_InterestRate] [float] NULL, ";
                SS = SS + " [F_InterestAmount] [numeric](18, 2) NULL, ";
                SS = SS + " [F_Previous] [numeric](18, 2) NULL, ";
                SS = SS + " [F_Remarks] [varchar](max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, ";
                SS = SS + " CONSTRAINT [PK_AccountForeClosure] PRIMARY KEY CLUSTERED ";
                SS = SS + " ([F_Id] ASC)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]) ON [PRIMARY]";
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            //========================================================================

            try
            {
                string Path = "Finance_Management_System.SQL.Calculation.sql";
                Assembly A = Assembly.GetExecutingAssembly();
                StreamReader D = new StreamReader(A.GetManifestResourceStream(Path));
                string SS = D.ReadToEnd();
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string Path = "Finance_Management_System.SQL.AlterCalculation.sql";
                Assembly A = Assembly.GetExecutingAssembly();
                StreamReader D = new StreamReader(A.GetManifestResourceStream(Path));
                string SS = D.ReadToEnd();
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string Path = "Finance_Management_System.SQL.CashReceipt.sql";
                Assembly A = Assembly.GetExecutingAssembly();
                StreamReader D = new StreamReader(A.GetManifestResourceStream(Path));
                string SS = D.ReadToEnd();
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string Path = "Finance_Management_System.SQL.CashPayment.sql";
                Assembly A = Assembly.GetExecutingAssembly();
                StreamReader D = new StreamReader(A.GetManifestResourceStream(Path));
                string SS = D.ReadToEnd();
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string Path = "Finance_Management_System.SQL.AlterLoanApplication.sql";
                Assembly A = Assembly.GetExecutingAssembly();
                StreamReader D = new StreamReader(A.GetManifestResourceStream(Path));
                string SS = D.ReadToEnd();
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            try
            {
                string Path = "Finance_Management_System.SQL.AlterLoanSanction.sql";
                Assembly A = Assembly.GetExecutingAssembly();
                StreamReader D = new StreamReader(A.GetManifestResourceStream(Path));
                string SS = D.ReadToEnd();
                ObjDataAccess.ExecuteQuery(SS);
            }
            catch { }

            //========================================================================

            Application.Run(new Frm_Main());
        }
Ejemplo n.º 3
0
        public static void SendSMS(string P_Id, string MessageBody)
        {
            ClsDataAccess Obj = new ClsDataAccess();
            try
            {
                string SSData = "Select a_mobile + ',' + a_mobile2 From AccountMaster Where A_id = " + P_Id + "";
                if (Obj.GetDataTable(SSData).Rows.Count > 0)
                {
                    string[] Mo = Obj.GetDataTable(SSData).Rows[0][0].ToString().Split(',');
                    for (int i = 0; i < Mo.Length; i++)
                    {
                        try
                        {
                            string MobNo = Mo[i].ToString();
                            MobNo = MobNo.Replace("(", "");
                            MobNo = MobNo.Replace(")", "");
                            MobNo = MobNo.Replace("+", "");
                            MobNo = MobNo.Replace("-", "");
                            MobNo = MobNo.Replace(",", "");

                            if (MobNo.Substring(0, 1) == "0" && MobNo.Length > 5)
                            {
                                MobNo = MobNo.Substring(1, MobNo.Length - 1);
                            }

                            if (MobNo.Trim().Length >= 10)
                            {
                                if (Program.SMSBY == 0 && Program.PortNo.Trim().Length > 0)
                                {
                                    #region MOBILE
                                    char[] arr = new char[1];
                                    arr[0] = (char)26;
                                    SerialPort sp = new SerialPort();
                                    sp.PortName = Program.PortNo;
                                    sp.BaudRate = 96000;
                                    sp.Parity = Parity.None;
                                    sp.DataBits = 8;
                                    sp.StopBits = StopBits.One;
                                    sp.Handshake = Handshake.XOnXOff;
                                    sp.DtrEnable = true;
                                    sp.RtsEnable = true;
                                    sp.NewLine = Environment.NewLine;
                                    sp.Open();
                                    int mSpeed = 1;
                                    sp.Write("AT+CMGF=1" + Environment.NewLine);
                                    System.Threading.Thread.Sleep(200);
                                    sp.Write("AT+CSCS=GSM" + Environment.NewLine);
                                    System.Threading.Thread.Sleep(200);
                                    sp.Write("AT+CMGS=" + (char)34 + "+91" + MobNo
                                    + (char)34 + Environment.NewLine);
                                    System.Threading.Thread.Sleep(200);
                                    sp.Write(MessageBody + (char)26);
                                    System.Threading.Thread.Sleep(mSpeed);
                                    sp.Close();
                                    #endregion
                                }
                                else if (Program.SMSBY == 1)
                                {
                                    #region WEB

                                    string UserId = Program.UserId;
                                    string UserPassword = Program.PasswordId;
                                    string UserSenderId = Program.SenderId;
                                    string Path1 = Program.Path1;
                                    string Path2 = Program.Path2;
                                    string Path3 = Program.Path3;
                                    string Path4 = Program.Path4;
                                    string Path5 = Program.Path5;
                                    string Path6 = Program.Path6;
                                    string Path7 = Program.Path7;

                                    WebClient client = new WebClient();
                                    string baseurl = Path1 + Path2 + UserId + Path3 + UserPassword + Path4 + UserSenderId + Path5 + MobNo + Path6 + MessageBody + Path7;
                                    Stream data = client.OpenRead(baseurl);
                                    StreamReader reader = new StreamReader(data);
                                    string s = reader.ReadToEnd();
                                    data.Close();
                                    reader.Close();

                                    #endregion
                                }
                            }
                        }
                        catch
                        {

                        }
                    }
                }
            }
            catch (Exception Erp)
            {
                clsGeneral.ShowErrMsg(Erp.Message);

            }
        }