private void MainFr_Load(object sender, EventArgs e)
        {
            sqlCON connect = new sqlCON();

            connect.sqlDatatablePermision("RegisterUser", btn_registeruser);
            connect.sqlDatatablePermision("Password", btn_changepass);
            connect.sqlDatatablePermision("PermissionForm", btn_permission);
            connect.sqlDatatablePermision("LineMaster", btn_line);
            connect.sqlDatatablePermision("ModelMaster", btn_model);
            connect.sqlDatatablePermision("ModelLine", btn_modelline);
            connect.sqlDatatablePermision("Dept", btn_dept);
            connect.sqlDatatablePermision("PQMShow", btn_pqmshow);
            connect.sqlDatatablePermision("ProcessInspect", btn_process);
            connect.sqlDatatablePermision("ERPConfigMail", btn_emailconfig);
            connect.sqlDatatablePermision("ProductionReport", btn_production);
            connect.sqlDatatablePermision("ShippingReport", btn_shipping);
            connect.sqlDatatablePermision("MQCShow", btn_MQC);
            connect.sqlDatatablePermision("PlanningShow", btn_Planning);
            connect.sqlDatatablePermision("CheckMaterial", btn_CheckMaterial);  //
            connect.sqlDatatablePermision("WarehouseAlarm", btn_warehousealarm);
            connect.sqlDatatablePermision("IPPLC", btn_ipplc);
            connect.sqlDatatablePermision("Wms", btn_wms);
            connect.sqlDatatablePermision("settingLanguage", btn_settingLanguage);
            connect.sqlDatatablePermision("MQCReview", btn_MQCReview);
            connect.sqlDatatablePermision("Manpower", btn_Manpower);
            connect.sqlDatatablePermision("ReliabilityReport", btn_Reliability);
            connect.sqlDatatablePermision("BackLogReport", btn_backlogReport);
            connect.sqlDatatablePermision("SeasonalEmp", btn_SeasonalEmp);
            connect.sqlDatatablePermision("FinishedGoods", btn_FinishedGoods);
            connect.sqlDatatablePermision("OVEN", btn_Oven);
            connect.sqlDatatablePermision("TypingInfo", btn_TypingInfor);
        }
        private void MainLayout_Load(object sender, EventArgs e)
        {
            sqlCON connect = new sqlCON();

            connect.sqlDatatablePermision("HRManagement", btn_HRManagement);
            connect.sqlDatatablePermision("ProductionManagement", btn_productionManagement);
            connect.sqlDatatablePermision("SystemConfigure", btn_SystemConfig);
            connect.sqlDatatablePermision("UserSetting", btn_userSetting);
        }
예제 #3
0
        private void MainFr_Load(object sender, EventArgs e)
        {
            sqlCON connect = new sqlCON();

            connect.sqlDatatablePermision("RegisterUser", btn_registeruser);
            connect.sqlDatatablePermision("Password", btn_changepass);
            connect.sqlDatatablePermision("PermissionForm", btn_permission);
            connect.sqlDatatablePermision("LineMaster", btn_line);
            connect.sqlDatatablePermision("ModelMaster", btn_model);
            connect.sqlDatatablePermision("ModelLine", btn_modelline);
            connect.sqlDatatablePermision("Dept", btn_dept);
            connect.sqlDatatablePermision("PQMShow", btn_pqmshow);
            connect.sqlDatatablePermision("ProcessInspect", btn_process);
            connect.sqlDatatablePermision("ERPConfigMail", btn_emailconfig);
            connect.sqlDatatablePermision("ProductionReport", btn_production);
            connect.sqlDatatablePermision("ShippingReport", btn_shipping);
            connect.sqlDatatablePermision("MQCShow", btn_MQC);
            connect.sqlDatatablePermision("CheckMaterial", btn_CheckMaterial);  //
            connect.sqlDatatablePermision("WarehouseAlarm", btn_warehousealarm);
            connect.sqlDatatablePermision("IPPLC", btn_ipplc);
        }
        void getERPdata()
        {
            DateTime dateto   = dtp_to.Value.Date;
            DateTime datefrom = dtp_from.Value.Date;

            dt = new DataTable();
            StringBuilder sql = new StringBuilder();

            sql.Append(@"select
CONVERT(date,coptcs.CREATE_DATE) as Create_Date,
coptcs.TC001 as Code_Type, 
coptcs.TC002 as Code_No,
coptcs.TC012 as Customer_No

 from COPTC coptcs
where 1=1 ");
            //if(ChooseDeptoSQLcommand(trv_department) != "")
            // {
            //     sql.Append(ChooseDeptoSQLcommand(trv_department));
            // }
            if (cmd_COPTC_TC001.Text != "")
            {
                sql.Append(" and coptcs.TC001   = '" + cmd_COPTC_TC001.Text + "'");
            }
            if (cmd_COPTC_TC002.Text != "")
            {
                sql.Append(" and coptcs.TC002   = '" + cmd_COPTC_TC002.Text + "'");
            }


            else
            {
                sql.Append(" and CONVERT(date,coptcs.CREATE_DATE)  >= '" + datefrom + "' ");
                sql.Append(" and CONVERT(date,coptcs.CREATE_DATE) <= '" + dateto + "' ");
            }
            sql.Append(@" group by 
                                   coptcs.CREATE_DATE,
                                    coptcs.TC001 ,
                                    coptcs.TC002 ,
                                   coptcs.TC012
                                    ");
            sql.Append(" order by coptcs.TC001, coptcs.TC002");
            sqlERPCON con = new sqlERPCON();

            con.sqlDataAdapterFillDatatable(sql.ToString(), ref dt);
            //checkdata
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string sqlcheck   = "";
                    string NgayTaoDon = dt.Rows[i]["Create_Date"].ToString().Replace("'", "");
                    string MaTaoDon   = dt.Rows[i]["Code_Type"].ToString().Replace("'", "");
                    string codeDon    = dt.Rows[i]["Code_No"].ToString().Replace("'", "");
                    string MAHK       = dt.Rows[i]["Customer_No"].ToString().Replace("'", "");
                    sqlcheck = "select COUNT(*) from t_OCTM where TM01 = '" + NgayTaoDon + "' and TM02 ='" + MaTaoDon + "' and TM03= '" + codeDon + "' and TM04 = '" + MAHK + "'";
                    sqlCON check = new sqlCON();
                    if (int.Parse(check.sqlExecuteScalarString(sqlcheck)) == 0) //insert
                    {
                        string list = "";
                        for (int j = 0; j < dt.Columns.Count; j++)
                        {
                            list += "'";
                            list += dt.Rows[i][j].ToString().Replace("'", "") + "',";
                        }
                        StringBuilder sqlinsert = new StringBuilder();
                        sqlinsert.Append("insert into t_OCTM ");
                        sqlinsert.Append(@"(TM01,TM02,TM03,TM04,UserName,datetimeRST) values ( ");
                        sqlinsert.Append(list);
                        sqlinsert.Append("'" + Class.valiballecommon.GetStorage().UserName + "',GETDATE())");
                        sqlCON insert = new sqlCON();
                        insert.sqlExecuteNonQuery(sqlinsert.ToString(), false);
                    }
                }
            }
        }
예제 #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string sql     = "select distinct usercode from m_user ";
            sqlCON connect = new sqlCON();

            connect.getComboBoxData(sql, ref cmb_user);
            if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
            {
                Version deploy = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion;

                StringBuilder version = new StringBuilder();
                //version.Append("VERSION:   ");
                version.Append("TechLink Version: ");
                version.Append(deploy.Major);
                version.Append("_");
                version.Append(deploy.Minor);
                version.Append("_");
                version.Append(deploy.Build);
                version.Append("_");
                version.Append(deploy.Revision);

                Version_lbl.Text = version.ToString();
                Class.valiballecommon.GetStorage()._version = Version_lbl.Text;
            }

            cb_Language.Items.Add("English");
            cb_Language.Items.Add("TiengViet");
            cb_Language.Items.Add("Chinese");

            cb_Database.Items.Add("TECHLINK");
            cb_Database.Items.Add("TLVN2");
            cb_Database.Items.Add("TEST03152021");
            Class.valiballecommon SettingGet = new Class.valiballecommon();
            if (File.Exists(PathSaveConfig))
            {
                SettingGet = (Class.valiballecommon)SaveObject.Load_data(PathSaveConfig);
                if (SettingGet.Language == null)
                {
                    cb_Language.SelectedItem = "English";
                }
                if (SettingGet.DBERP == null)
                {
                    cb_Database.SelectedItem = "TLVN2";
                }
                Class.valiballecommon.GetStorage().Warehouse  = SettingGet.Warehouse;
                Class.valiballecommon.GetStorage().Department = SettingGet.Department;
                Class.valiballecommon.GetStorage().Currency   = SettingGet.Currency;
                Class.valiballecommon.GetStorage().Client     = SettingGet.Client;
                //tuanngoc
                Class.valiballecommon.GetStorage().DocNo = SettingGet.DocNo;
            }
            else
            {
                cb_Language.SelectedItem = "English";
                cb_Database.SelectedItem = "TLVN2";
            }
            if (SettingGet.DBERP != null)
            {
                cb_Database.SelectedItem = SettingGet.DBERP;
            }
            if (SettingGet.UserCode != null)
            {
                cmb_user.SelectedItem = SettingGet.UserCode;
            }
            if (SettingGet.Language != null)
            {
                cb_Language.SelectedItem = SettingGet.Language;
            }
        }
예제 #6
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            //MySql_importfg_warehouse tem = new MySql_importfg_warehouse();
            //if (tem.Open())
            //{
            //    MessageBox.Show("Connect Mysql sucess");
            //    return;
            //}
            //else
            //{
            //    return;
            //}
            if (checkdata() == false)
            {
                return;
            }
            string sqlusername   = "******" + cmb_user.Text + "'";
            string sqlpass       = "******" + cmb_user.Text + "'";
            string sqlpermission = "select distinct permission from m_user where  usercode = '" + cmb_user.Text + "'";
            sqlCON connect       = new sqlCON();

            if (connect.sqlExecuteScalarString(sqlpass) != txt_pass.Text)
            {
                infomesge mes = new infomesge();
                mes.ErrorMesger("Password is not correct", "Warning System", this);
                txt_pass.Text = "";
                return;
            }
            sqlCON connected = new sqlCON();
            sqlCON permi     = new sqlCON();

            Class.valiballecommon va = Class.valiballecommon.GetStorage();
            va.UserName   = connected.sqlExecuteScalarString(sqlusername);
            va.Permission = permi.sqlExecuteScalarString(sqlpermission);
            va.UserCode   = cmb_user.Text;
            if (cb_Language.SelectedItem != null)
            {
                va.Language = (string)cb_Language.SelectedItem;
            }
            if (cb_Database.SelectedItem != null)
            {
                if (cb_Database.SelectedItem.ToString() == "TECHLINK")
                {
                    va.DBERP = "TECHLINK";
                    va.DBSFT = "SFT_TECHLINK";
                }
                else if (cb_Database.SelectedItem.ToString() == "TLVN2")
                {
                    va.DBERP = "TLVN2";
                    va.DBSFT = "SFT_TLVN2";
                }
                else if (cb_Database.SelectedItem.ToString() == "TEST03152021")
                {
                    va.DBERP = "TEST03152021";
                    va.DBSFT = "SFT_TEST03152021";
                }
            }
            MainLayout mainLayout = new MainLayout();

            mainLayout.Show();
            //this.Hide();
            //MainFr newfr = new MainFr();
            //newfr.Show();
            //   this.Hide();
        }