Beispiel #1
0
        private void btnAddCategory_Click(object sender, EventArgs e)
        {
            UnitName = txtUnit.Text.ToString().Trim().Replace("'", "''");
            string strCREATE = this._UserID.ToString() != "" ? this._UserID.ToString() : "0";

            //chkNull or Empty
            if (UnitName == "")
            {
                FUNCT.msgWarning("Please Key Unit!"); txtUnit.Focus(); return;
            }
            else
            {
                //chkDup
                if (DB.DBQuery("SELECT OIDUNIT FROM Unit WHERE UnitName = N'" + UnitName + "' ").getString() != "")
                {
                    FUNCT.msgWarning("Unit is Duplicate!"); txtUnit.Focus(); return;
                }
                else
                {
                    //Confirm Save
                    if (FUNCT.msgQuiz("Save Unit ? ") == true)
                    {
                        sql = "INSERT INTO Unit (UnitName, CreatedBy, CreatedDate, UpdatedBy, UpdatedDate) VALUES(N'" + UnitName + "', '" + strCREATE + "', GETDATE(), '" + strCREATE + "', GETDATE())";
                        //Console.WriteLine(sql);
                        bool chkSave = DB.DBQuery(sql).runSQL();
                        if (chkSave == true)
                        {
                            FUNCT.msgInfo("Save Unit is Successufull.");
                            this.Close();
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void btnAddCategory_Click(object sender, EventArgs e)
        {
            FabricPart = txtFabricParts.Text.ToString().Trim().Replace("'", "''");
            string strCREATE = this._UserID.ToString() != "" ? this._UserID.ToString() : "0";

            //chkNull or Empty
            if (FabricPart == "")
            {
                FUNCT.msgWarning("Please Key Fabric Parts !"); txtFabricParts.Focus(); return;
            }
            else
            {
                //chkDup
                if (DB.DBQuery("SELECT TOP(1) OIDGParts FROM GarmentParts WHERE GarmentParts = N'" + FabricPart + "' ").getString() != "")
                {
                    FUNCT.msgWarning("Fabric Parts is Duplicate!"); txtFabricParts.Focus(); return;
                }
                else
                {
                    //Confirm Save
                    if (FUNCT.msgQuiz("Save Fabric Parts ? ") == true)
                    {
                        sql = "INSERT INTO GarmentParts (GarmentParts, CreatedBy, CreatedDate) VALUES(N'" + FabricPart + "', '" + strCREATE + "', GETDATE())";
                        //Console.WriteLine(sql);
                        bool chkSave = DB.DBQuery(sql).runSQL();
                        if (chkSave == true)
                        {
                            FUNCT.msgInfo("Save Fabric Parts is Successufull.");
                            this.Close();
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void btnAddCustomer_Click(object sender, EventArgs e)
        {
            string CustomerName      = txtCustomerName.Text.ToString().Trim().Replace("'", "''");
            string CustomerShortName = txtCustomerShortName.Text.ToString().Trim().Replace("'", "''");

            CustomerCode = txtCustomerCode.Text.ToString().Trim().Replace("'", "''");

            string strCREATE = this._UserID.ToString() != "" ? this._UserID.ToString() : "0";

            if (CustomerName == "")
            {
                chkNull("CustomerName", txtCustomerName);
            }
            else if (CustomerShortName == "")
            {
                chkNull("CustomerShortName", txtCustomerShortName);
            }
            else if (CustomerCode == "")
            {
                chkNull("CustomerCode", txtCustomerCode);
            }
            else
            {
                //chkDup
                if (DB.DBQuery("SELECT TOP (1) ShortName From Customer WHERE ShortName = '" + CustomerShortName + "' ").getString() != "")
                {
                    FUNCT.msgWarning("CustomerShortName is Duplicate!"); txtCustomerShortName.Focus(); return;
                }
                else if (DB.DBQuery("SELECT TOP(1) Code FROM Customer WHERE Code = '" + CustomerCode + "' ").getString() != "")
                {
                    FUNCT.msgWarning("CustomerCode is Duplicate!"); txtCustomerCode.Focus(); return;
                }
                else
                {
                    if (FUNCT.msgQuiz("SAVE Customer?") == true)
                    {
                        sql = "INSERT INTO Customer(Name, ShortName, Code, CustomerType, CreatedBy, CreatedDate, UpdatedBy, UpdatedDate) VALUES (N'" + CustomerName + "', N'" + CustomerShortName + "', N'" + CustomerCode + "', '9', '" + strCREATE + "', GETDATE(), '" + strCREATE + "', GETDATE())";
                        bool chkSave = DB.DBQuery(sql).runSQL();
                        if (chkSave == true)
                        {
                            FUNCT.msgInfo("Save Customer is Successfull.");
                            this.Close();
                        }
                    }
                }
            }
        }
Beispiel #4
0
        private void btnAddCustomer_Click(object sender, EventArgs e)
        {
            ColorNo = txeColorNo.Text.ToString().ToUpper().Trim().Replace("'", "''");
            string ColorName = txeColorName.Text.ToString().Trim().Replace("'", "''");
            string ColorType = cbeColorType.EditValue.ToString();

            string strCREATE = this._UserID.ToString() != "" ? this._UserID.ToString() : "0";

            if (ColorNo == "")
            {
                chkNull("Color No.", txeColorNo);
            }
            else if (ColorName == "")
            {
                chkNull("Color Name", txeColorName);
            }
            else if (cbeColorType.Text.Trim() == "")
            {
                chkNull("Color Type", cbeColorType);
            }
            else
            {
                //chkDup
                if (DB.DBQuery("SELECT TOP(1) ColorNo FROM ProductColor WHERE (ColorType = '" + ColorType + "') AND (ColorNo = N'" + ColorNo + "') ").getString() != "")
                {
                    FUNCT.msgWarning("Color No. is Duplicate!"); txeColorNo.Focus(); return;
                }
                else
                {
                    if (FUNCT.msgQuiz("SAVE Color ?") == true)
                    {
                        sql = "INSERT INTO ProductColor(ColorNo, ColorName, ColorType, CreatedBy, CreatedDate) VALUES(N'" + ColorNo + "', N'" + ColorName + "', '" + ColorType + "', '" + strCREATE + "', GETDATE()) ";
                        //Console.WriteLine(sql);
                        bool chkSave = DB.DBQuery(sql).runSQL();
                        if (chkSave == true)
                        {
                            FUNCT.msgInfo("Save Color is Successfull.");
                            this.Close();
                        }
                    }
                }
            }
        }
Beispiel #5
0
        private void btnAddStyle_Click(object sender, EventArgs e)
        {
            StyleName = txtStyleName.Text.ToString().Trim().Replace("'", "''");
            string CategoryName = glCategoryName.Text.ToString();

            string strCREATE = this._UserID.ToString() != "" ? this._UserID.ToString() : "0";

            //chkNull or Empty
            if (StyleName == "")
            {
                FUNCT.msgWarning("Please Key StyleName!"); txtStyleName.Focus(); return;
            }
            else if (CategoryName == "")
            {
                FUNCT.msgWarning("Please Select CategoryName!"); glCategoryName.Focus(); return;
            }
            else
            {
                //chkDup
                if (DB.DBQuery("SELECT TOP(1) StyleName FROM ProductStyle WHERE StyleName = '" + StyleName + "' ").getString() != "")
                {
                    FUNCT.msgWarning("StyleName is Duplicate!"); txtStyleName.Focus(); return;
                }
                else
                {
                    //Confirm Save
                    if (FUNCT.msgQuiz("Save StyleName ? ") == true)
                    {
                        sql = "INSERT INTO ProductStyle (StyleName, OIDGCATEGORY, CreatedBy, CreatedDate) VALUES(N'" + StyleName + "', '" + glCategoryName.EditValue.ToString() + "', '" + strCREATE + "', GETDATE())";
                        //Console.WriteLine(sql);
                        bool chkSave = DB.DBQuery(sql).runSQL();
                        if (chkSave == true)
                        {
                            FUNCT.msgInfo("Save StyleName is Successufull.");
                            this.Close();
                        }
                    }
                }
            }
        }
Beispiel #6
0
        private void btnAddCategory_Click(object sender, EventArgs e)
        {
            UseFor = txtUseFor.Text.ToString().Trim().Replace("'", "''");
            string strCREATE = this._UserID.ToString() != "" ? this._UserID.ToString() : "0";

            //chkNull or Empty
            if (UseFor == "")
            {
                FUNCT.msgWarning("Please Key UseFor!"); txtUseFor.Focus(); return;
            }
            else
            {
                //chkDup
                if (DB.DBQuery("SELECT TOP(1) OIDUF FROM SMPLUseFor WHERE UseFor = N'" + UseFor + "' ").getString() != "")
                {
                    FUNCT.msgWarning("UseFor is Duplicate!"); txtUseFor.Focus(); return;
                }
                else
                {
                    //Confirm Save
                    if (FUNCT.msgQuiz("Save UseFor ? ") == true)
                    {
                        StringBuilder sbSQL = new StringBuilder();
                        sbSQL.Append("INSERT INTO SMPLUseFor (OIDUF, UseFor, CreatedBy) ");
                        sbSQL.Append(" SELECT MAX(OIDUF) + 1 AS OIDUF, N'" + UseFor + "' AS UseFor, '" + strCREATE + "' AS CreatedBy ");
                        sbSQL.Append(" FROM SMPLUseFor ");
                        //Console.WriteLine(sql);
                        bool chkSave = DB.DBQuery(sbSQL).runSQL();
                        if (chkSave == true)
                        {
                            FUNCT.msgInfo("Save UseFor is Successufull.");
                            this.Close();
                        }
                    }
                }
            }
        }
Beispiel #7
0
 private void M11_01_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (Application.OpenForms.OfType <M11>().Count() > 0)
     {
         var           frmD01 = Application.OpenForms.OfType <M11>().FirstOrDefault();
         StringBuilder sbSQL  = new StringBuilder();
         sbSQL.Append("SELECT CategoryName, OIDGCATEGORY AS ID ");
         sbSQL.Append("FROM GarmentCategory ");
         sbSQL.Append("ORDER BY CategoryName ");
         new ObjDE.setGridLookUpEdit(frmD01.glueCategory, sbSQL, "CategoryName", "ID").getData(true);
         if (CategoryName != "")
         {
             frmD01.glueCategory.EditValue = DB.DBQuery("SELECT TOP(1) OIDGCATEGORY FROM GarmentCategory WHERE CategoryName=N'" + CategoryName + "'").getString();
         }
         frmD01.glueCategory.Properties.View.PopulateColumns(frmD01.glueCategory.Properties.DataSource);
         frmD01.glueCategory.Properties.View.Columns["ID"].Visible = false;
     }
 }
Beispiel #8
0
        private void btnAddCustomer_Click(object sender, EventArgs e)
        {
            CusCode = txeCode.Text.ToString().ToUpper().Trim().Replace("'", "''");
            string CusName = txeName.Text.ToString().Trim().Replace("'", "''");
            string CusType = cbeType.EditValue.ToString();

            string strCREATE = this._UserID.ToString() != "" ? this._UserID.ToString() : "0";

            if (CusCode == "")
            {
                chkNull("Vendor Code", txeCode);
            }
            else if (CusName == "")
            {
                chkNull("Vendor Name", txeName);
            }
            else if (cbeType.Text.Trim() == "")
            {
                chkNull("Vendor Type", cbeType);
            }
            else
            {
                //chkDup
                if (DB.DBQuery("SELECT TOP(1) OIDVEND FROM Vendor WHERE (Code = N'" + CusCode + "') ").getString() != "")
                {
                    FUNCT.msgWarning("Vendor Code is Duplicate!"); txeCode.Focus(); return;
                }
                else
                {
                    if (FUNCT.msgQuiz("SAVE Supplier (Vendor) ?") == true)
                    {
                        sql = "INSERT INTO Vendor(Code, Name, VendorType, CreatedBy, CreatedDate, UpdatedBy, UpdatedDate) VALUES(N'" + CusCode + "', N'" + CusName + "', '" + CusType + "', '" + strCREATE + "', GETDATE(), '" + strCREATE + "', GETDATE()) ";
                        //Console.WriteLine(sql);
                        bool chkSave = DB.DBQuery(sql).runSQL();
                        if (chkSave == true)
                        {
                            FUNCT.msgInfo("Save Supplier (Vendor) is Successfull.");
                            this.Close();
                        }
                    }
                }
            }
        }
Beispiel #9
0
        private void DEV01_M07_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (Application.OpenForms.OfType <DEV01>().Count() > 0)
            {
                var           frmD01 = Application.OpenForms.OfType <DEV01>().FirstOrDefault();
                StringBuilder sbSQL  = new StringBuilder();
                if (this._tmpType == "FB")                               //Fabric
                {
                    sbSQL.Append("SELECT Code, Description, Type, ID "); //fabric & temporary
                    sbSQL.Append("FROM (");
                    sbSQL.Append("  SELECT Code, Description, 'Fabric' AS Type, MaterialType, OIDITEM AS ID FROM Items WHERE (MaterialType = '" + TYPE_FABRIC + "') ");
                    sbSQL.Append("  UNION ALL ");
                    sbSQL.Append("  SELECT Code, Description, 'Temporary' AS Type, MaterialType, OIDITEM AS ID FROM Items WHERE (MaterialType = '" + TYPE_TEMPORARY + "') AND (Code LIKE 'TMPFB%') ");
                    sbSQL.Append(") AS FBCode ");
                    sbSQL.Append("ORDER BY MaterialType, Code ");
                    new ObjDE.setSearchLookUpEdit(frmD01.slFBCode_FB, sbSQL, "Code", "ID").getData();
                    frmD01.slFBCode_FB.Properties.View.PopulateColumns(frmD01.slFBCode_FB.Properties.DataSource);
                    frmD01.slFBCode_FB.Properties.View.Columns["ID"].Visible = false;

                    frmD01.rep_slueFBCode.DataSource    = frmD01.slFBCode_FB.Properties.DataSource;
                    frmD01.rep_slueFBCode.DisplayMember = "Code";
                    frmD01.rep_slueFBCode.ValueMember   = "ID";
                    frmD01.rep_slueFBCode.BestFitMode   = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
                    frmD01.rep_slueFBCode.View.PopulateColumns(frmD01.rep_slueFBCode.DataSource);
                    frmD01.rep_slueFBCode.View.Columns["ID"].Visible = false;

                    frmD01.lblDescription.Text = "-";
                    frmD01.lblDescription.AppearanceItemCaption.BackColor = Color.Empty;
                }
                else if (this._tmpType == "MT")                          //Material
                {
                    sbSQL.Append("SELECT Code, Description, Type, ID "); //fabric & temporary
                    sbSQL.Append("FROM (");
                    sbSQL.Append("  SELECT Code, Description, 'Meterial' AS Type, MaterialType, OIDITEM AS ID FROM Items WHERE (MaterialType IN ('" + TYPE_ACCESSORY + "', '" + TYPE_PACKAGING + "')) ");
                    sbSQL.Append("  UNION ALL ");
                    sbSQL.Append("  SELECT Code, Description, 'Temporary' AS Type, MaterialType, OIDITEM AS ID FROM Items WHERE (MaterialType = '" + TYPE_TEMPORARY + "') AND (Code LIKE 'TMPMT%') ");
                    sbSQL.Append(") AS FBCode ");
                    sbSQL.Append("ORDER BY MaterialType, Code ");
                    new ObjDE.setSearchLookUpEdit(frmD01.slMatCode_Mat, sbSQL, "Code", "ID").getData();
                    frmD01.slMatCode_Mat.Properties.View.PopulateColumns(frmD01.slMatCode_Mat.Properties.DataSource);
                    frmD01.slMatCode_Mat.Properties.View.Columns["ID"].Visible = false;

                    frmD01.rep_MtrItem.DataSource    = frmD01.slMatCode_Mat.Properties.DataSource;
                    frmD01.rep_MtrItem.DisplayMember = "Code";
                    frmD01.rep_MtrItem.ValueMember   = "ID";
                    frmD01.rep_MtrItem.BestFitMode   = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
                    frmD01.rep_MtrItem.View.PopulateColumns(frmD01.rep_MtrItem.DataSource);
                    frmD01.rep_MtrItem.View.Columns["ID"].Visible = false;

                    frmD01.txeMatDescription.Text      = "";
                    frmD01.txeMatDescription.BackColor = Color.Empty;
                }


                if (ItemCode != "")
                {
                    string[] arrFB = DB.DBQuery("SELECT TOP(1) Description, OIDITEM AS ID FROM Items WHERE (Code = N'" + ItemCode + "') ").getMultipleValue();
                    if (arrFB.Length > 0)
                    {
                        if (this._tmpType == "FB")//Fabric
                        {
                            frmD01.slFBCode_FB.EditValue = arrFB[1];
                            frmD01.lblDescription.Text   = arrFB[0] == "" ? "-" : arrFB[0];
                            frmD01.lblDescription.AppearanceItemCaption.BackColor = Color.FromArgb(255, 255, 192);
                        }
                        else if (this._tmpType == "MT") //Material
                        {
                            frmD01.slMatCode_Mat.EditValue     = arrFB[1];
                            frmD01.txeMatDescription.Text      = arrFB[0] == "" ? "-" : arrFB[0];
                            frmD01.txeMatDescription.BackColor = Color.FromArgb(255, 255, 192);
                        }
                    }
                }
            }
        }