private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }


            ConnectionToMySQL cnn       = new ConnectionToMySQL();
            DataTable         dtTemplte = cnn.GetDataTable("select ifnull(max(b.pkid),0)+1 from TEMPLET_HEADER b");

            txtPkId.Text = dtTemplte.Rows[0][0].ToString();

            int icheck = cnn.TranDataToDB("insert into TEMPLET_HEADER values(" + txtPkId.Text + "," +
                                          glb_function.glb_strUserId + ",sysdate(),'" + txtTempletName.Text + "','" +
                                          glb_function.GetCellValue(ref dgvForms, clmFormEnName.DisplayIndex, dgvForms.SelectedIndex) + "','" +
                                          glb_function.GetCellValue(ref dgvForms, clmFormArName.DisplayIndex, dgvForms.SelectedIndex) + "','" +
                                          glb_function.GetCellValue(ref dgvForms, clmMultiForm.DisplayIndex, dgvForms.SelectedIndex) + "','" +
                                          glb_function.GetCellValue(ref dgvForms, clmFormTypeEn.DisplayIndex, dgvForms.SelectedIndex) + "','" +
                                          glb_function.GetCellValue(ref dgvForms, clmFormTypeAr.DisplayIndex, dgvForms.SelectedIndex) + "')");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية الحفظ");
                return;
            }
            int iProSwid = 0;

            dtTemplte.Clear();
            dtTemplte = cnn.GetDataTable("select ifnull(max(b.pkid),0)+1 from TEMPLET_DETAILS b");
            iProSwid  = Convert.ToInt16(dtTemplte.Rows[0][0].ToString());

            for (int i = 0; i < dgProperities.Items.Count; i++)
            {
                icheck = cnn.TranDataToDB("insert into TEMPLET_DETAILS values(" + iProSwid.ToString() +
                                          "," + txtPkId.Text +
                                          ",'" +
                                          glb_function.GetCellValue(ref dgProperities, clmcontrol_type.DisplayIndex, i) + "','" +
                                          glb_function.GetCellValue(ref dgProperities, clmen_name.DisplayIndex, i) + "','" +
                                          glb_function.GetCellValue(ref dgProperities, clmPropertyName.DisplayIndex, i) + "','" +
                                          glb_function.GetCellValueControl(ref dgProperities, "TextBox", clmPropertyValue.DisplayIndex, i) + "'," +
                                          glb_function.glb_strUserId + ",sysdate(),'" +
                                          (glb_function.GetCellValue(ref dgProperities, clmRealValue.DisplayIndex, i) == "" ? glb_function.GetCellValueControl(ref dgProperities, "TextBox", clmPropertyValue.DisplayIndex, i) : glb_function.GetCellValue(ref dgProperities, clmRealValue.DisplayIndex, i)) + "')");
                iProSwid++;

                if (icheck <= 0)
                {
                    cnn.glb_RollbackTransaction();
                    glb_function.MsgBox("حدث خطأ اثناء عملية الحفظ");
                    return;
                }
            }
            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت عملية الحفظ بنجاح");



            dgProperities.Items.Clear();
            txtTempletName.Text = "";
        }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            DataTable         dtSU;
            int    icheck     = 0;
            string strSU_Pkid = "";

            if (lstStandardUnit.SelectedIndex == -1)
            {
                dtSU       = cnn.GetDataTable("select ifnull(max(b.pkid),0)+1 from standard_unit b");
                strSU_Pkid = dtSU.Rows[0][0].ToString();
                icheck     = cnn.TranDataToDB("insert into standard_unit values(" +
                                              "(" + strSU_Pkid + ")" +
                                              ",'" + lstStandardUnit.Text.Trim() + "'" +

                                              ")");

                if (icheck <= 0)
                {
                    cnn.glb_RollbackTransaction();
                    glb_function.MsgBox("حدث خطأ اثناء عملية الاضافة");
                    return;
                }
            }
            else
            {
                strSU_Pkid = lstStandardUnit.SelectedValue.ToString();
            }

            icheck = cnn.TranDataToDB("insert into units values (" +
                                      "(select ifnull(max(b.pkid),0)+1 from units b)" +
                                      ",''" +
                                      ",sysdate()" +
                                      "," + glb_function.glb_strUserId +
                                      "," + strSU_Pkid +
                                      ",'" + txtUnitName.Text.Trim() + "'" +
                                      "," + nmbUnitValue.Value.ToString() +
                                      ",'" + (ckbIsMainUnit.Checked == true ? "1" : "0") + "'" +
                                      ",'" + txtUnitNote.Text.Trim() + "'" +
                                      ",'" + (ckbIsPurchaseUnit.Checked == true ? "1" : "0") + "'" +
                                      ")");
            if (icheck <= 0)
            {
                cnn.glb_RollbackTransaction();
                glb_function.MsgBox("حدث خطأ اثناء عملية الاضافة");
                return;
            }

            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت عملية الاضافة بنجاح");
            GetData(strSU_Pkid);
        }
示例#3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (lstEmp.SelectedIndex == -1)
            {
                glb_function.MsgBox("الرجاء اختيار العامل");
                lstEmp.Focus();
                return;
            }

            if (lstPumps.SelectedIndex == -1)
            {
                glb_function.MsgBox("الرجاء اختيار الطرمبة");
                lstPumps.Focus();
                return;
            }

            ConnectionToMySQL cnn     = new ConnectionToMySQL();
            ConnectionToMySQL cnnSave = new ConnectionToMySQL();

            int icheck = cnnSave.TranDataToDB("insert into pump_emp " +
                                              " values((select ifnull(max(b.pkid),0)+1 from pump_emp b)" +
                                              ",'فعال'" +
                                              ",SYSDATE() " +
                                              "," + glb_function.glb_strUserId +
                                              ",str_to_date('" + dtpWorkingDate.Value.ToString("dd/MM/yyyy") + "','%d/%m/%Y')" +
                                              ",'" + lstEmp.SelectedValue.ToString() + "'" +
                                              "," + lstPumps.SelectedValue.ToString() +

                                              ")");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية اضافة البيانات");
                return;
            }

            icheck = cnnSave.TranDataToDB("update pumps set stat ='شغالة' where pkid=" + lstPumps.SelectedValue.ToString());
            if (icheck <= 0)
            {
                cnnSave.glb_RollbackTransaction();
                glb_function.MsgBox("حدث خطأ اثناء عملية اضافة البيانات");
                return;
            }


            cnnSave.glb_commitTransaction();

            lstEmp.SelectedIndex   = -1;
            lstPumps.SelectedIndex = -1;
            FillPumps();
            GetData();
        }
示例#4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            glb_function.strDbCnnString = "server=localhost;port=3300;charset=utf8;database=ammar2016;userid=root;password=bigboss;SslMode=none;AllowPublicKeyRetrieval=True";
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = 0;

            for (int i = 0; i < myDataGrid1.Rows.Count; i++)
            {
                icheck = cnn.TranDataToDB("insert into accounts values(" + myDataGrid1[0, i].Value.ToString() +
                                          ",'فعال'" +
                                          ",sysdate()" +
                                          ",1" +
                                          ",'" + myDataGrid1[0, i].Value.ToString() + "'" +
                                          ",'" + myDataGrid1[1, i].Value.ToString() + "'" +
                                          "," + (myDataGrid1[2, i].Value.ToString() == ""?"null":"'" + myDataGrid1[2, i].Value.ToString() + "'") +
                                          ",''" +
                                          ",'" + myDataGrid1[5, i].Value.ToString() + "'" +
                                          ",'" + myDataGrid1[6, i].Value.ToString() + "'" +
                                          ",''" +
                                          ",''" +
                                          ",'" + myDataGrid1[4, i].Value.ToString() + "'" +
                                          ")");

                if (icheck <= 0)
                {
                    cnn.glb_RollbackTransaction();
                    glb_function.MsgBox("Error");
                    return;
                }
            }

            cnn.glb_commitTransaction();
            glb_function.MsgBox("Save");
        }
示例#5
0
        private void button6_Click(object sender, EventArgs e)
        {
            glb_function.strDbCnnString = "server=localhost;port=3300;charset=utf8;database=ammar2018;userid=root;password=bigboss;SslMode=none;AllowPublicKeyRetrieval=True";
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = 0;
            int jourNo            = 2;

            for (int i = 0; i < myDataGrid1.Rows.Count; i++)
            {
                icheck = cnn.TranDataToDB("insert into journal_header values(" + myDataGrid1[1, i].Value.ToString() +
                                          ",'مرحل'" +
                                          ",sysdate()" +
                                          ",1" +
                                          ",1" +
                                          ",'1-" + jourNo + "'" +
                                          ",'سند قيد'" +
                                          "," + (i + 1) +
                                          ",str_to_date('" + myDataGrid1[2, i].Value.ToString() + "',' %d/%m/%Y')" +
                                          ",''" +
                                          ",null" +
                                          ",'1-" + (i + 1) + "'" +
                                          ")");

                jourNo++;
                if (icheck <= 0)
                {
                    glb_function.MsgBox("Error");
                    return;
                }
            }

            cnn.glb_commitTransaction();
            glb_function.MsgBox("Save");
        }
示例#6
0
        private void dgvProperities_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex <= -1)
            {
                return;
            }
            if (e.ColumnIndex == clmDelete.Index)
            {
                if (glb_function.MsgBox("هل تريد الحذف بالفعل؟", "", true) == false)
                {
                    return;
                }

                if (dgvProperities[clmPkid.Index, e.RowIndex].Value.ToString() == "")
                {
                    dgvProperities.Rows.Remove(dgvProperities.CurrentRow);
                }

                else
                {
                    ConnectionToMySQL cnn = new ConnectionToMySQL();
                    int icheck            = cnn.TranDataToDB("delete from forms_de where pkid=" + dgvProperities[0, e.RowIndex].Value.ToString());

                    if (icheck <= 0)
                    {
                        glb_function.MsgBox("حدث خطأ اثناء عملية الحذف");
                        return;
                    }
                    cnn.glb_commitTransaction();
                    dgvProperities.Rows.Remove(dgvProperities.CurrentRow);
                }

                glb_function.MsgBox("تمت العملية بنجاح");
            }
        }
示例#7
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();

            string str    = nmbPumpCounter.Value.ToString();
            int    icheck = cnnSave.TranDataToDB("update pumps set " +

                                                 " created_user="******",PumpNo='" + txtPumpNo.Text.Trim() + "'" +
                                                 ",PumpName='" + txtPumpName.Text.Trim() + "'" +
                                                 ",stat='" + lstPumpStat.Text.Trim() + "'" +
                                                 ",PumpCounter=" + nmbPumpCounter.Value.ToString() + "" +
                                                 ",warehouse_id=" + lstWareHouse.SelectedValue.ToString() +
                                                 ",item_id=" + lstItems.SelectedValue.ToString() +
                                                 ",PumpNote='" + txtPumpNote.Text.Trim() + "'" +

                                                 " where pkid=" + txtPkid.Text);

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية تعديل بيانات الصنف");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }
示例#8
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();


            int icheck = cnnSave.TranDataToDB("update Items set " +

                                              " created_user="******",itemno='" + txtItemNo.Text.Trim() + "'" +
                                              ",itemname='" + txtItemName.Text.Trim() + "'" +
                                              ",itemtype='" + lstItemType.Text.Trim() + "'" +
                                              ",Standard_Unit_id=" + lstUnits.SelectedValue.ToString() +
                                              ",UnitCost=" + nmbCostValue.Value.ToString() +
                                              ",UnitSellingPrice=" + nmbSellingPriceValue.Value.ToString() +
                                              ",itemnote='" + txtItemNote.Text.Trim() + "'" +
                                              " where pkid=" + txtPkid.Text);

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية تعديل بيانات الصنف");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }
示例#9
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (txtVALUE_MEMBER.Text.Trim() == "")
            {
                glb_function.MsgBox("الرجاء ادخال رقم التعريف");
                txtVALUE_MEMBER.Focus();
                return;
            }


            if (txtDISPLAY_MEMBER.Text.Trim() == "")
            {
                glb_function.MsgBox("الرجاء ادخال القيمة");
                txtDISPLAY_MEMBER.Focus();
                return;
            }



            dgvFreeList.Items.Clear();
            ConnectionToMySQL cnn     = new ConnectionToMySQL();
            DataTable         dtGetid = cnn.GetDataTable("select ifnull(max(b.pkid),0)+1 from FREE_LIST b");

            txtSwid.Text = dtGetid.Rows[0][0].ToString();
            int icheck = cnn.TranDataToDB("insert into FREE_LIST values(" + txtSwid.Text + ",'" + lstLIST_NAME.Text + "','" + txtDISPLAY_MEMBER.Text + "','" + txtVALUE_MEMBER.Text + "')");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية الاضافة");
                return;
            }
            cnn.glb_commitTransaction();
            GetData(lstLIST_NAME.Text);
            glb_function.MsgBox("تمت العملية بنجاح.");
        }
示例#10
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();


            int icheck = cnnSave.TranDataToDB("update warehouse " +
                                              " set " +
                                              " created_user="******",warehouse_no='" + txtWareHouseNo.Text.Trim() + "'" +
                                              ",warehouse_name='" + txtWareHouseName.Text.Trim() + "'" +
                                              ",branch_id=" + lstBranches.SelectedValue.ToString() +
                                              ",warehouse_note='" + txtWarehouseNote.Text.Trim() + "'" +
                                              " where pkid=" + txtPkid.Text.Trim());

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية تعديل بيانات المستخدم");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }
示例#11
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            if (txtProfitCenter.Text.Trim() == "")
            {
                glb_function.MsgBox("الرجاء ادخال اسم مركز الربحية");
                txtProfitCenter.Focus();
                return;
            }
            for (int i = 0; i < dgvJournalData.Rows.Count; i++)
            {
                if (txtProfitCenter.Text.Trim() == dgvJournalData[clmName.Index, i].Value.ToString())
                {
                    glb_function.MsgBox("مركز الربحية مدخل من قبل");
                    txtProfitCenter.Focus();
                    return;
                }
            }
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = cnn.TranDataToDB("insert into profitcenter values(" +
                                                     "(select ifnull(max(b.pkid),0)+1 from profitcenter b)" +
                                                     ",'" + txtProfitCenter.Text.Trim() + "'" +
                                                     ")");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء العملية");
                return;
            }
            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت الاضافة بنجاح");

            GetAccounts();
        }
示例#12
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();
            DataTable         dt      = cnnSave.GetDataTable("(select ifnull(max(b.pkid),0)+1 from warehouse b)");

            txtPkid.Text = dt.Rows[0][0].ToString();
            int icheck = cnnSave.TranDataToDB("insert into warehouse " +
                                              " values(" + txtPkid.Text + "" +
                                              ",'فعال'" +
                                              ",SYSDATE() " +
                                              "," + glb_function.glb_strUserId +
                                              ",'" + txtWareHouseNo.Text.Trim() + "'" +
                                              ",'" + txtWareHouseName.Text.Trim() + "'" +
                                              "," + lstBranches.SelectedValue.ToString() +
                                              ",'" + txtWarehouseNote.Text.Trim() + "'" +
                                              ")");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية حفظ بيانات المستخدم");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }
示例#13
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            ConnectionToMySQL conn = new ConnectionToMySQL();

            System.Data.DataTable dtLogin = conn.GetDataTable("select pkid from users " +
                                                              " where UserFullName='" + glb_function.glb_strUserName.Trim() + "' and PASSWORD='******'");

            if (dtLogin != null && dtLogin.Rows.Count != 0)
            {
                if (txtPassword.Password.Trim() != txtConfirmPass.Password.Trim())
                {
                    glb_function.MsgBox("كلمة السر غير متطابقة");
                    return;
                }

                int icheck = conn.TranDataToDB("update  users set PASSWORD='******' where pkid=" + glb_function.glb_strUserId);
                if (icheck <= 0)
                {
                    conn.glb_RollbackTransaction();
                    glb_function.MsgBox("حدث خطأ عند تغير كلمة السر");
                    return;
                }

                conn.glb_commitTransaction();
                glb_function.MsgBox("تمت عملية تغير كلمة السر بنجاح" + "\n" + "الرجاء تسجيل الدخول للتاكد");

                this.Close();
            }
            else
            {
                glb_function.MsgBox("الرجاء التاكد من كلمة السر السابقة", "رسالة نظام");
                return;
            }
        }
示例#14
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = cnn.TranDataToDB("insert into currency values(" +
                                                     "(SELECT ifnull(max(b.pkid),0)+1 FROM currency b)" +
                                                     ",'فعال'" +
                                                     ",sysdate()" +
                                                     "," + glb_function.glb_strUserId +
                                                     ",'" + txtCurr_name.Text.Trim() + "'" +
                                                     ",'" + txtCURR_SMPL.Text.Trim() + "'" +
                                                     ",'" + numCURR_DECIMAL.Value.ToString() + "'" +
                                                     ",'" + numCURR_CHANGE_Rate.Value.ToString() + "'" +
                                                     ",'" + txtCURR_NOTE.Text.Trim() + "'" +
                                                     ",'" + (ckbIsMainCurr.Checked == true ? "1" : "0") + "'" +
                                                     ",'" + (ckbIsInvCurr.Checked == true ? "1" : "0") + "'" +
                                                     ")");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء الإضافة");
                return;
            }

            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت عملية الإضافة بنجاح");

            txtCurr_name.Text         = "";
            txtCURR_SMPL.Text         = "";
            txtCURR_NOTE.Text         = "";
            numCURR_DECIMAL.Value     = 0;
            numCURR_CHANGE_Rate.Value = 0;
            ckbIsMainCurr.Checked     = false;
            ckbIsInvCurr.Checked      = false;
            GetCurrency();
        }
示例#15
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();


            int icheck = cnnSave.TranDataToDB("update emp set " +

                                              " created_user="******",empno='" + txtEmpNo.Text.Trim() + "'" +
                                              ",empname='" + txtEmpName.Text.Trim() + "'" +
                                              ",address='" + txtAddress.Text.Trim() + "'" +
                                              ",tel='" + txtTel.Text.Trim() + "'" +
                                              ",branch_id=" + lstBranches.SelectedValue.ToString() +
                                              ",empNote='" + txtEmpNote.Text.Trim() + "'" +
                                              ",acc_id=" + lstAccNo.SelectedValue.ToString() +
                                              " where pkid=" + txtPkid.Text);

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية تعديل بيانات العامل");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }
示例#16
0
        private void  AddAccount()
        {
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = cnn.TranDataToDB("insert into accounts values(" +
                                                     "(SELECT ifnull(max(b.pkid),0)+1 FROM accounts b)" +
                                                     ",'فعال'" +
                                                     ",sysdate()" +
                                                     "," + glb_function.glb_strUserId +
                                                     ",'" + txtAccNo.Text + "'" +
                                                     ",'" + txtAccName.Text.Trim() + "'" +
                                                     ",'" + txtParentId.Text.Trim() + "'" +
                                                     ",'" + txtAccNote.Text.Trim() + "'" +
                                                     ",'" + txtLevel.Text.Trim() + "'" +
                                                     ",'" + strAccShortNo.Trim() + "'" +
                                                     ")");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء الإضافة");
                return;
            }

            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت عملية الإضافة بنجاح");

            txtAccNo.Text   = "";
            txtAccName.Text = "";
            txtAccNote.Text = "";
            GetAccNo();
        }
示例#17
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();

            int icheck = cnnSave.TranDataToDB("update vendors set " +

                                              " created_user="******",vendorno='" + txtVendorNo.Text.Trim() + "'" +
                                              ",vendorname='" + txtVendorName.Text.Trim() + "'" +
                                              ",addess1='" + txtAddress1.Text.Trim() + "'" +
                                              ",addess2='" + txtAddress2.Text.Trim() + "'" +
                                              ",tel1='" + txtTel1.Text.Trim() + "'" +
                                              ",tel2='" + txtTel2.Text.Trim() + "'" +
                                              ",acc_id=" + (lstAccNo.SelectedIndex == -1 ? "null" : lstAccNo.SelectedValue.ToString()) +
                                              ",vendornote'" + txtVendorNote.Text.Trim() + "'" +
                                              " where pkid=" + txtPkid.Text);

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية تعديل بيانات المورد");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }
示例#18
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (txtPkid.Text == "")
            {
                glb_function.MsgBox("الرجاء تحديد الحساب");
                return;
            }



            //if (txtLevel.Text.Trim() != "5")
            //{
            //    glb_function.MsgBox("لايمكن حذف حساب رئيسي");
            //    return;
            //}
            ConnectionToMySQL cnn   = new ConnectionToMySQL();
            DataTable         dtAcc = cnn.GetDataTable("SELECT d.pkid " +
                                                       " FROM journal_details d " +
                                                       " join accounts a on(d.acc_id = a.pkid) " +
                                                       " where a.Acc_no like '" + txtAccNo.Text.Trim() + "%'");

            if (dtAcc != null && dtAcc.Rows.Count > 0)
            {
                glb_function.MsgBox("لايمكن حذف الحساب لارتباطه بعمليات في اليومية");
                return;
            }

            dtAcc.Clear();
            dtAcc = cnn.GetDataTable("SELECT pkid FROM accounts " +
                                     "  where parent_id = " + txtParentId.Text +
                                     "  and Acc_short_no > " + txtAccShoreNo.Text);

            if (dtAcc != null && dtAcc.Rows.Count > 0)
            {
                glb_function.MsgBox("يوجد حساب بعد هذا الحساب" + "\n" + "لايمكن الحذف");
                return;
            }

            if (glb_function.MsgBox("هل انت متاكد من اتمام عملية الحذف", "تنبية", true) == false)
            {
                return;
            }

            int icheck = cnn.TranDataToDB("delete from accounts where Acc_no like '" + txtAccNo.Text.Trim() + "%'");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية الحذف");
                return;
            }

            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت عملية الحذف بنجاح");
            tvAccounts.Nodes.Remove(tvAccounts.SelectedNode);
            //FillAccountTree();
        }
示例#19
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnn       = new ConnectionToMySQL();
            DataTable         dtTemplte = cnn.GetDataTable("select ifnull(max(b.pkid),0)+1 from FORMS_hd b");

            txtSwid.Text = dtTemplte.Rows[0][0].ToString();



            int icheck = cnn.TranDataToDB("insert into FORMS_hd values(" + txtSwid.Text + ",'" + txtAR_NAME.Text + "','" + txtEN_NAME.Text + "','" + (ckbMULTI_FORM_FOR_USER.IsChecked == true ? "1" : "0") + "','" + ((ListBoxItem)lstFormType.Items[lstFormType.Items.IndexOf(lstFormType.SelectedItem)]).Tag.ToString() + "','" + lstFormType.Text.Trim() + "')");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء العملية");
                return;
            }



            for (int i = 0; i < dgvProperities.Items.Count; i++)
            {
                if (glb_function.GetCellValue(ref dgvProperities, clmSwid.DisplayIndex, i) == "")
                {
                    icheck = cnn.TranDataToDB("insert into FORMs_de values((select ifnull(max(b.pkid),0)+1 from FORMs_de b)," + txtSwid.Text + ",'" + glb_function.GetCellValue(ref dgvProperities, clmFieldType.DisplayIndex, i) + "','" + glb_function.GetCellValue(ref dgvProperities, clmFieldNameEn.DisplayIndex, i) + "','" + glb_function.GetCellValue(ref dgvProperities, clmFieldNameAr.DisplayIndex, i) + "'," + glb_function.GetCellValue(ref dgvProperities, clmListTypeId.DisplayIndex, i) + ",'" + glb_function.GetCellValue(ref dgvProperities, clmFreeList.DisplayIndex, i) + "','" + glb_function.GetCellValue(ref dgvProperities, clmNote.DisplayIndex, i) + "')");

                    if (icheck <= 0)
                    {
                        cnn.glb_RollbackTransaction();
                        glb_function.MsgBox("حدث خطأ اثناء العملية");
                        return;
                    }
                }
            }

            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtSwid.Text.Trim());
        }
示例#20
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }
            DataTable         dtTemplte = new DataTable();
            ConnectionToMySQL cnn       = new ConnectionToMySQL();



            int icheck = cnn.TranDataToDB("update FORMS_hd set AR_NAME='" + txtAR_NAME.Text + "',EN_NAME='" + txtEN_NAME.Text + "',MULTI_FORM_FOR_USER='******',form_type_en='" + lstFormType.SelectedValue.ToString() + "',form_type_ar='" + lstFormType.Text.Trim() + "' where pkid=" + txtPkid.Text);

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء العملية");
                return;
            }
            for (int i = 0; i < dgvProperities.Rows.Count; i++)
            {
                if (dgvProperities[clmPkid.Index, i].Value.ToString() == "")
                {
                    icheck = cnn.TranDataToDB("insert into FORMs_de values((select ifnull(max(b.pkid),0)+1 from FORMs_de b)," + txtPkid.Text + ",'" + dgvProperities[clmFieldType.Index, i].Value.ToString() + "','" + dgvProperities[clmFieldNameEn.Index, i].Value.ToString() + "','" + dgvProperities[clmFieldNameAr.Index, i].Value.ToString() + "'," + dgvProperities[clmListTypeId.Index, i].Value.ToString() + ",'" + dgvProperities[clmFreeList.Index, i].Value.ToString() + "','" + dgvProperities[clmNote.Index, i].Value.ToString() + "')");

                    if (icheck <= 0)
                    {
                        cnn.glb_RollbackTransaction();
                        glb_function.MsgBox("حدث خطأ اثناء العملية");
                        return;
                    }
                }
            }

            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");



            GetData(txtPkid.Text.Trim());
        }
示例#21
0
        private void dgvCurrencies_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            if (e.ColumnIndex == clmUpdateCurrency.Index)
            {
                string strPkid        = dgvCurrencies[clmPkid.Index, e.RowIndex].Value.ToString();
                string strIsMainCurr  = dgvCurrencies[clmMainCurr.Index, e.RowIndex].Value.ToString();
                string strExhangeRate = dgvCurrencies[clmExchangeRate.Index, e.RowIndex].Value.ToString();

                if (strIsMainCurr.Trim() == "1")
                {
                    glb_function.MsgBox("لايمكن تغيير سعر صرف العملة الرئيسية");
                    GetCurrency();
                    return;
                }

                ConnectionToMySQL cnn = new ConnectionToMySQL();
                int icheck            = cnn.TranDataToDB("update currency set curr_change_rate=" + strExhangeRate + " where pkid=" + strPkid);

                if (icheck <= 0)
                {
                    glb_function.MsgBox("حدث خطأ اثناء عملية التعديل");
                    return;
                }
                cnn.glb_commitTransaction();
                glb_function.MsgBox("تمت عملية التعديل بنجاح");
            }
            else if (clmExchangeRate.Index == e.ColumnIndex)
            {
                DataGridViewCell abc  = dgvCurrencies.CurrentCell;
                Rectangle        RECT = dgvCurrencies.GetCellDisplayRectangle(abc.ColumnIndex, abc.RowIndex, true);



                nmbEditor.W_ColumnName = e.ColumnIndex.ToString();

                nmbEditor.Tag = e.RowIndex.ToString();


                if (dgvCurrencies[clmExchangeRate.Index, e.RowIndex].Value == null || dgvCurrencies[clmExchangeRate.Index, e.RowIndex].Value.ToString() == "")
                {
                    dgvCurrencies[clmExchangeRate.Index, e.RowIndex].Value = "0";
                }

                nmbEditor.Value = Convert.ToDecimal(dgvCurrencies[clmExchangeRate.Index, e.RowIndex].Value.ToString());

                CtlLocation(RECT, nmbEditor);
            }
        }
示例#22
0
        private void btnPosting_Click(object sender, EventArgs e)
        {
            if (dgvEntries.Rows.Count > 0)
            {
                ConnectionToMySQL cnn = new ConnectionToMySQL();
                int icheck            = 0;
                int iCount            = 0;
                for (int i = 0; i < dgvEntries.Rows.Count; i++)
                {
                    if (dgvEntries[clmSelect.Index, i].Value == null || dgvEntries[clmSelect.Index, i].Value.ToString() == "False")
                    {
                        continue;
                    }



                    string strPkid = dgvEntries[clmPKid.Index, i].Value.ToString();
                    icheck = cnn.TranDataToDB("update journal_header set stat='مرحل' where pkid=" + strPkid);
                    iCount++;
                    if (icheck <= 0)
                    {
                        cnn.glb_RollbackTransaction();
                        glb_function.MsgBox("حدث خطأ اثناء عملية الترحيل");
                        return;
                    }

                    if (!glb_function.UpdateHistory("journal_header", "stat", strPkid, "فعال", "مرحل", "الحالة"))
                    {
                        cnn.glb_RollbackTransaction();
                        glb_function.MsgBox("حدث خطأ عند ادخال التعديل الى بيانات التتبع");
                        return;
                    }
                }

                if (iCount == 0)
                {
                    glb_function.MsgBox("لم يتم تحديد اي مستند للترحيل");
                }
                else
                {
                    cnn.glb_commitTransaction();
                    glb_function.MsgBox("تمت عملية الترحيل بنجاح");
                    GetUnPostingData();
                    ckbAll.Checked = false;
                }
            }
            else
            {
                glb_function.MsgBox("لا توجد بيانات للترحيل");
            }
        }
示例#23
0
        private void UpdateAccount()
        {
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = cnn.TranDataToDB("update accounts set " +
                                                     " Acc_Name='" + txtAccName.Text.Trim() + "'" +
                                                     ",notes='" + txtAccNote.Text.Trim() + "'" +
                                                     " where pkid=" + txtPkid.Text);

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية التعديل");
                return;
            }
            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت عملية التعديل بنجاح");
        }
示例#24
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtPkid.Text.Trim() == "")
            {
                glb_function.MsgBox("الرجاء اختيار فرع");
                return;
            }

            if (txtBranchNo.Text.Trim() == "")
            {
                glb_function.MsgBox("الرجاء ادخال رقم الفرع");
                txtBranchNo.Focus();
                return;
            }
            if (txtBranchName.Text.Trim() == "")
            {
                glb_function.MsgBox("الرجاء ادخال اسم الفرع");
                txtBranchName.Focus();
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();

            int icheck = cnnSave.TranDataToDB("update branches " +
                                              " set " +
                                              " Branch_no='" + txtBranchNo.Text.Trim() + "'" +
                                              ",Branch_name='" + txtBranchName.Text.Trim() + "'" +
                                              ",notes='" + txtNote.Text.Trim() + "'" +
                                              " where pkid=" + txtPkid.Text.Trim());

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية تعديل بيانات الفرع");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");



            GetData(txtPkid.Text);
        }
示例#25
0
        public static bool UpdateHistory(string strTableName, string strColName, string strPkid, string strOldValue, string strNewValue, string strColArName)
        {
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = 0;

            // insert into sales.USER_TEMPLET values((select ifnull(max(b.pkid),0)+1 from sales.USER_TEMPLET b),

            icheck = cnn.TranDataToDB("insert into updatehistory values((select ifnull(max(b.pk),0)+1 from updatehistory b)," + glb_function.glb_strUserId + ",sysdate(),'" + strTableName + "','" + strColName + "'," + strPkid + ",'" + strOldValue + "','" + strNewValue + "','" + strColArName + "')");

            if (icheck <= 0)
            {
                return(false);
            }


            cnn.glb_commitTransaction();
            return(true);
        }
示例#26
0
        private void button4_Click(object sender, EventArgs e)
        {
            glb_function.strDbCnnString = "server=localhost;port=3300;charset=utf8;database=ammar2018;userid=root;password=bigboss;SslMode=none;AllowPublicKeyRetrieval=True";
            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = 0;

            string strAmount = "";

            for (int i = 0; i < myDataGrid1.Rows.Count; i++)
            {
                if (myDataGrid1[6, i].Value.ToString().Trim() == "0")
                {
                    strAmount = "-" + myDataGrid1[7, i].Value.ToString().Trim();
                }
                else
                {
                    strAmount = myDataGrid1[6, i].Value.ToString().Trim();
                }

                icheck = cnn.TranDataToDB("insert into journal_details values((select ifnull(max(b.pkid),0)+1 from journal_details b)" +
                                          ",'فعال'" +
                                          ",sysdate()" +
                                          ",1" +
                                          "," + myDataGrid1[10, i].Value.ToString() +
                                          ",1" +
                                          "," + myDataGrid1[3, i].Value.ToString() +
                                          "," + strAmount +
                                          "," + strAmount +
                                          ",1" +
                                          ",'" + myDataGrid1[11, i].Value.ToString() + "'" +
                                          ",'" + myDataGrid1[13, i].Value.ToString() + "'" +
                                          ")");
                if (icheck <= 0)
                {
                    cnn.glb_RollbackTransaction();
                    glb_function.MsgBox("Error");
                    return;
                }
            }


            cnn.glb_commitTransaction();
            glb_function.MsgBox("Save");
        }
示例#27
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();
            DataTable         dt      = cnnSave.GetDataTable("(select ifnull(max(b.pkid),0)+1 from Items b)");

            txtPkid.Text = dt.Rows[0][0].ToString();
            int icheck = cnnSave.TranDataToDB("insert into Items " +
                                              " values(" + txtPkid.Text + "" +
                                              ",'فعال'" +
                                              ",SYSDATE() " +
                                              "," + glb_function.glb_strUserId +
                                              ",'" + lstItemGroup.Text.Trim() + "'" +
                                              ",'" + txtItemNo.Text.Trim() + "'" +
                                              ",'" + txtItemName.Text.Trim() + "'" +
                                              ",'" + lstItemType.Text.Trim() + "'" +
                                              "," + lstCostCurrency.SelectedValue.ToString() +
                                              "," + nmbCostValue.Value.ToString() +
                                              "," + nmbCostValue_yr.Value.ToString() +
                                              "," + lstSellingPriceCurrency.SelectedValue.ToString() +
                                              "," + nmbSellingPriceValue.Value.ToString() +
                                              "," + nmbSellingPrice_yr.Value.ToString() +
                                              "," + (ckbSellingPriceEditable.IsChecked == true?"1":"0") +
                                              ",'" + txtItemNote.Text.Trim() + "'" +
                                              "," + (lstVendor.SelectedIndex == -1?"null": lstVendor.SelectedValue.ToString()) +
                                              ")");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية حفظ بيانات الصنف");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }
示例#28
0
        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();


            int icheck = cnnSave.TranDataToDB("insert into Items set " +

                                              " created_user="******",itemgroup='" + lstItemGroup.Text.Trim() + "'" +
                                              ",itemno='" + txtItemNo.Text.Trim() + "'" +
                                              ",itemname'" + txtItemName.Text.Trim() + "'" +
                                              ",itemtype='" + lstItemType.Text.Trim() + "'" +
                                              ",cost_currency=" + lstCostCurrency.SelectedValue.ToString() +
                                              ",cost_Value=" + nmbCostValue.Value.ToString() +
                                              ",cost_Value_yr=" + nmbCostValue_yr.Value.ToString() +
                                              ",sellingPrice_currency=" + lstSellingPriceCurrency.SelectedValue.ToString() +
                                              ",sellingPrice_value=" + nmbSellingPriceValue.Value.ToString() +
                                              ",sellingPrice_yr=" + nmbSellingPrice_yr.Value.ToString() +
                                              ",sellingPrice_editable=" + (ckbSellingPriceEditable.IsChecked == true ? "1" : "0") +
                                              ",itemnote='" + txtItemNote.Text.Trim() + "'" +
                                              ",vendor_id=" + (lstVendor.SelectedIndex == -1 ? "null" : lstVendor.SelectedValue.ToString()) +
                                              " where pkid=" + txtPkid.Text);

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية تعديل بيانات الصنف");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtExpName.Text.Trim() == "")
            {
                glb_function.MsgBox("الرجاء ادخال اسم المصروف");
                txtExpName.Focus();
                return;
            }
            if (lstAccNo.SelectedIndex == -1 || lstAccName.SelectedIndex == -1)
            {
                glb_function.MsgBox("الرجاء اختيار الحساب");
                lstAccNo.Focus();
                return;
            }


            ConnectionToMySQL cnn = new ConnectionToMySQL();
            int icheck            = cnn.TranDataToDB("insert into purchase_expensses " +
                                                     " values((select ifnull(max(b.pkid),0)+1 from purchase_expensses b)" +
                                                     ",'" + txtExpName.Text.Trim() + "'" +
                                                     "," + lstAccNo.SelectedValue.ToString() +
                                                     ",'" + lstCalcType.Text.Trim() + "'" +
                                                     "," + nmbExpValue.Value.ToString() +
                                                     ")");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء اضافة المصروف");
                return;
            }
            cnn.glb_commitTransaction();
            glb_function.MsgBox("تمت اضافة المصروف بنجاح");
            lstAccNo.SelectedIndex   = -1;
            lstAccName.SelectedIndex = -1;
            txtExpName.Text          = "";
            lstCalcType.Text         = "مبلغ";
            nmbExpValue.Value        = 0;
            GetData();
        }
示例#30
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!CheckEntries())
            {
                return;
            }

            ConnectionToMySQL cnnSave = new ConnectionToMySQL();
            DataTable         dt      = cnnSave.GetDataTable("(select ifnull(max(b.pkid),0)+1 from vendors b)");

            txtPkid.Text = dt.Rows[0][0].ToString();
            int icheck = cnnSave.TranDataToDB("insert into vendors " +
                                              " values(" + txtPkid.Text + "" +
                                              ",'فعال'" +
                                              ",SYSDATE() " +
                                              "," + glb_function.glb_strUserId +
                                              ",'" + txtVendorNo.Text.Trim() + "'" +
                                              ",'" + txtVendorName.Text.Trim() + "'" +
                                              ",'" + txtAddress1.Text.Trim() + "'" +
                                              ",'" + txtAddress2.Text.Trim() + "'" +
                                              ",'" + txtTel1.Text.Trim() + "'" +
                                              ",'" + txtTel2.Text.Trim() + "'" +

                                              "," + (lstAccNo.SelectedIndex == -1 ? "null" : lstAccNo.SelectedValue.ToString()) +
                                              ",'" + txtVendorNote.Text.Trim() + "'" +
                                              ")");

            if (icheck <= 0)
            {
                glb_function.MsgBox("حدث خطأ اثناء عملية حفظ بيانات المورد");
                return;
            }



            cnnSave.glb_commitTransaction();
            glb_function.MsgBox("تمت العملية بنجاح");
            GetData(txtPkid.Text);
        }