コード例 #1
0
 private void frmStartUpPage_Load(object sender, EventArgs e)
 {
     objIni.SetKeyFieldValue("APP_PATH", "path", Path.GetDirectoryName(Application.ExecutablePath));
     objIni.SetKeyFieldValue("APP_PATH", "bakuppath", Path.GetDirectoryName(Application.ExecutablePath) + "\\BAKUP");
     objIni.SetKeyFieldValue("SQL", "initial catalog", "master");
     if (!objVALIDATION.Find_DB_Existance())
     {
         this.Hide();
         if (objVALIDATION.Create_DataBase("InodeMFG", "InodeMFG"))
         {
             frm_mainmenu objmain = new frm_mainmenu();
             objmain.ObjBLMainFields.Login_type = "notlogin";
             objmain.ObjBLMainFields.CurUser    = "******";
             objmain.ObjBLMainFields.Fin_yr     = "";
             objmain.ObjBLMainFields.Comp_nm    = "0";
             objmain.ShowDialog();
             this.Close();
         }
         else
         {
             AutoClosingMessageBox.Show("Creating InodeMFG is not Successfull", "Error", 3000);
         }
     }
     else
     {
         this.Hide();
         frmLogin objLogin = new frmLogin();
         objLogin.ShowDialog();
         this.Close();
     }
     this.BackColor      = Color.White; this.ForeColor = Color.Black; ucToolBar1.Width = this.Width; this.ucToolBar1.Maximize = false;
     ucToolBar1.Width1   = this.Width;
     ucToolBar1.Titlebar = "Start Up Form";
 }
コード例 #2
0
ファイル: frmLogin.cs プロジェクト: abhijithnayak123/ERP
        public void processLogin()
        {
            DataSet dset = objVALIDATION.Get_Company_Details_Fin_Yr(cmbComp_nm.SelectedValue.ToString(), cmbfin_yr.SelectedValue.ToString());
            this.Hide();
            frm_mainmenu objmain = new frm_mainmenu();

            //objmain.Text = dset.Tables[0].Rows[0]["comp_nm"].ToString();
            objmain.ObjBLMainFields = objBLMain;
            objmain.ObjBLMainFields.Login_type = "login";
            objmain.ObjBLMainFields.CurUser = txtUserNm.Text;
            objmain.ObjBLMainFields.Fin_yr = cmbfin_yr.SelectedValue.ToString();
            objmain.ObjBLMainFields.Comp_nm = cmbComp_nm.SelectedValue.ToString();
            objmain.ObjBLMainFields.No_of_users = objBLMain.No_of_users;
            objmain.ObjBLMainFields.User_theme = objBLMain.User_theme;

            if (dset != null && dset.Tables.Count != 0 && dset.Tables[0].Rows.Count != 0)
            {
                //user logg. Sharanamma on 05.04.14
                if (dset.Tables[0].Rows[0]["db_nm"] != null && dset.Tables[0].Rows[0]["db_nm"].ToString() != "")
                {
                    objIni.SetKeyFieldValue("SQL", "initial catalog", dset.Tables[0].Rows[0]["db_nm"].ToString());//setting database
                    objFLGENINV.InsertUpdateAndDelete(objBLMain.CurUser, "1", objBLMain.Local_ip);//update datetime
                    objIni.SetKeyFieldValue("SQL", "initial catalog", "InodeMFG");//setting database
                }

                Type t = typeof(Company);
                PropertyInfo[] publicFieldInfos = t.GetProperties(BindingFlags.Instance | BindingFlags.Public);

                foreach (PropertyInfo field in publicFieldInfos)
                {
                    foreach (DataColumn col in dset.Tables[0].Columns)
                    {
                        if (null != field && field.CanWrite && field.Name.ToLower() == col.ColumnName.ToLower())
                        {
                            if (field.PropertyType.Name.ToLower() != "string")
                            {
                                if (dset.Tables[0].Rows[0][col.ColumnName] != null && dset.Tables[0].Rows[0][col.ColumnName].ToString() != "")
                                {
                                    objmain.ObjBLComp.GetType().GetProperty(field.Name).SetValue(objmain.ObjBLComp, Convert.ChangeType(dset.Tables[0].Rows[0][col.ColumnName].ToString(), field.PropertyType), null);
                                }
                            }
                            else
                                objmain.ObjBLComp.GetType().GetProperty(field.Name).SetValue(objmain.ObjBLComp, Convert.ChangeType(dset.Tables[0].Rows[0][col.ColumnName].ToString(), field.PropertyType), null);
                        }
                    }
                }
                objmain.ObjBLComp.Fin_yr = cmbfin_yr.SelectedValue.ToString();
                objmain.ObjBLComp.Compid = int.Parse(cmbComp_nm.SelectedValue.ToString());
                objIni.SetKeyFieldValue("APP_PATH", "bakuppath", objmain.ObjBLComp.Frm_bakup);
                objmain.ShowDialog();
            }
            this.Close();
        }