예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(area_text.Text) && !String.IsNullOrEmpty(price_txt.Text) && !String.IsNullOrEmpty(Qest_type_text.Text))
     {
         try
         {
             conn.startConnection();
             String area  = area_text.Text;
             int    price = int.Parse(price_txt.Text);
             int    type  = int.Parse(Qest_type_text.Text);
             String sql   = "INSERT INTO units (unit_type,qest_system,unit_price,available_units) VALUES (" + area + "," + type + "," + price + ",0)";
             conn.SQLUPDATE(sql, true);
             tryloadthis(area);
             FunctionsClass fc = new FunctionsClass();
         }
         catch (Exception ex)
         {
             MessageBox.Show("خطأ ف البيانات المدخلة");
             Logger.WriteLog("[" + DateTime.Now + "] ExceptionString: " + ex.ToString() + " InnerException: " + ex.InnerException + " ExceptionMessage: " + ex.Message + ". [" + this.Name + "] By [" + SessionInfo.empName + "]");
         }
     }
     else
     {
         MessageBox.Show("برجاء اتمام البيانات");
     }
 }
        private void LoadData()
        {
            FunctionsClass x = new FunctionsClass();

            foreach (ComboBoxItem item in FunctionsClass.areasData)
            {
                unitTypes.Items.Add(item);
            }
        }
        private void loadData()
        {
            FunctionsClass x = new FunctionsClass();

            foreach (ComboBoxItem item in FunctionsClass.banksData)
            {
                comboBox1.Items.Add(item);
            }
        }
예제 #4
0
        private void initTyeps()
        {
            // load here items from dbTable then through it to combobox
            FunctionsClass x = new FunctionsClass();

            foreach (ComboBoxItem item in FunctionsClass.areasData)
            {
                comboBox1.Items.Add(item);
            }
        }
 public TransferUnit()
 {
     InitializeComponent();
     c1.startConnection();
     FunctionsClass.loadAreaTyeps();
     foreach (ComboBoxItem item in FunctionsClass.areasData)
     {
         unitType.Items.Add(item);
     }
 }
        private void loadAreas()
        {
            FunctionsClass e = new FunctionsClass();

            foreach (ComboBoxItem item in FunctionsClass.areasData)
            {
                comboBox1.Items.Add(item);
            }
            loadUnitsClientsCount();
        }
 private void saveButton_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(newBankAccount.Text))
     {
         #region save
         con.startConnection();
         String sql = "insert into bank_accounts (type) values ('" + newBankAccount.Text + "')";
         con.SQLUPDATE(sql, true);
         newBankAccount.Text = "";
         FunctionsClass w = new FunctionsClass();
         #endregion
     }
 }
 private void ClientReportForm_Load(object sender, EventArgs e)
 {
     EmpNameLab.Text   = SessionInfo.empName;
     todayDateLab.Text = DateTime.Now.ToString("dd/MM/yyy");
     LoadGeneralData();
     if (unitTypeComb_LateTab.Items.Count == 0)
     {
         FunctionsClass.loadAreaTyeps();
         foreach (ComboBoxItem item in FunctionsClass.areasData)
         {
             unitTypeComb_LateTab.Items.Add(item);
         }
     }
 }
예제 #9
0
        private void loadData()
        {
            FunctionsClass x = new FunctionsClass();

            foreach (ComboBoxItem item in FunctionsClass.banksData)
            {
                if (item.Text == "اسكان")
                {
                    IskanIndex = FunctionsClass.banksData.IndexOf(item);
                }
                accountType.Items.Add(item);
                intesabAccount.Items.Add(item);
            }
            intesabAccount.SelectedIndex = IskanIndex;
            accountType.SelectedIndex    = IskanIndex;



            foreach (ComboBoxItem item in FunctionsClass.areasData)
            {
                unitType.Items.Add(item);
            }
        }
        private void transferButton_Click(object sender, EventArgs e)
        {
            if (clientId != 0)
            {
                #region Func
                if (string.IsNullOrWhiteSpace(nationalIdText.Text))
                {
                    err = new ErrorProvider();
                    err.SetError(nationalIdText, "يجب إدخال  الرقم القومي");
                }
                else
                {
                    if (err != null)
                    {
                        err.Clear();
                    }
                }

                if (string.IsNullOrWhiteSpace(unitType.Text))
                {
                    unitErr = new ErrorProvider();
                    err.SetError(unitType, "يجب إدخال نوع الوحدة المحول إليها  ");
                }
                else
                {
                    if (unitErr != null)
                    {
                        unitErr.Clear();
                    }
                }

                //Sql commands

                if (!string.IsNullOrWhiteSpace(unitType.Text) && !string.IsNullOrWhiteSpace(nationalIdText.Text) && unitType.Text != currentUnitState.Text)
                {
                    try
                    {
                        String selectUnit = "select ID from units where unit_type=" + int.Parse(unitType.Text.ToString());
                        c1.SQLCODE(selectUnit, false);
                        int unittyperetrie = 0;
                        while (c1.myReader.Read())
                        {
                            unittyperetrie = int.Parse(c1.myReader["ID"].ToString());
                        }
                        FunctionsClass.updtaeMyScriptHistory(clientId);
                        String sqlupdateToOld = "update ClientsUnits set RecoredState='O' where (client_id=" + clientId + " and RecoredState='N')";
                        c1.SQLUPDATE(sqlupdateToOld, false);

                        String sqlinsert = "insert into ClientsUnits(client_id,unit_id,RecoredState)values(" + clientId + "," + unittyperetrie + ",'N')";
                        c1.SQLUPDATE(sqlinsert, false);

                        String updateUnitsSql = "update units set available_units=available_units-1 where unit_type=" + int.Parse(unitType.Text);
                        c1.SQLUPDATE(updateUnitsSql, false);
                        updateUnitsSql = "update units set available_units=available_units+1 where unit_type=" + int.Parse(currentUnitState.Text);
                        c1.SQLUPDATE(updateUnitsSql, true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("خطأ ف البيانات المدخلة");
                        Logger.WriteLog("[" + DateTime.Now + "] ExceptionString: " + ex.ToString() + " InnerException: " + ex.InnerException + " ExceptionMessage: " + ex.Message + ". [" + this.Name + "] By [" + SessionInfo.empName + "]");
                    }

                    //clear all errors
                    if (unitErr != null)
                    {
                        unitErr.Clear();
                    }
                    if (err != null)
                    {
                        err.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("خطأ ف البيانات المدخلة");
                }
            }
            #endregion
        }
        private void button4_Click(object sender, EventArgs e)
        {
            //validate
            if (string.IsNullOrWhiteSpace(nationalIDMota.Text))
            {
                err = new ErrorProvider();
                err.SetError(nationalIDMota, "يجب إدخال  الرقم القومي");
            }
            else
            {
                if (err != null)
                {
                    err.Clear();
                }
            }

            //insert into tanazolat
            if (err == null && MotnazelToComplete && motnazelID != 0 && !string.IsNullOrEmpty(MotnazelToNationalId))
            {
                try
                {
                    String motanazaElleh = MotnazelToNationalId;
                    String subquery      = "select ID from Clients where national_id='" + motanazaElleh + "'";
                    c1.SQLCODE(subquery, false);
                    int ToID     = 0;
                    int unitType = 0;
                    while (c1.myReader.Read())
                    {
                        ToID = int.Parse(c1.myReader["ID"].ToString());
                    }

                    if (ToID != 0 && motnazelID != 0)
                    {
                        String da     = tanazolDate.Value.ToString("yyyy/MM/dd");
                        String query1 = "insert into tanazolat (from_id,to_id,tanazol_date) values (" + motnazelID + "," + ToID + ",#" + da + "#)";
                        if (c1.SQLUPDATE(query1, false))
                        {
                            String query2 = "update Clients set TnazolState ='F' where id=" + motnazelID + "";
                            c1.SQLUPDATE(query2, false);
                            String query3 = "update Clients set TnazolState ='T' where id=" + ToID + "";
                            c1.SQLUPDATE(query3, false);
                            //We need to update aqsat history to be with the new client ID
                            String query4 = "update aqsat set client_id=" + ToID + ",details='تم نقل القسط بعد التنازل' where client_id=" + motnazelID + "";
                            c1.SQLUPDATE(query4, false);
                            String query5 = "update first_paids set client_id=" + ToID + " where client_id=" + motnazelID + "";
                            c1.SQLUPDATE(query5, false);
                            String query6 = "update T5sesMoney set client_id =" + ToID + " where client_id=" + motnazelID + "";
                            c1.SQLUPDATE(query6, false);
                            //
                            String unitTypeTanazolSql = "select * from ClientsUnits where client_id=" + motnazelID + " ORDER BY ClientsUnits.ID DESC";
                            c1.SQLCODE(unitTypeTanazolSql, false);
                            if (c1.myReader.Read())
                            {
                                unitType = int.Parse(c1.myReader["unit_id"].ToString());
                            }
                            String sql2 = "insert into ClientsUnits(client_id,unit_id,RecoredState)values(" + ToID + "," + unitType + ",'N')";
                            c1.SQLUPDATE(sql2, true);
                            FunctionsClass.updtaeMyScriptHistory(motnazelID);
                            this.Close();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("خطأ ف البيانات المدخلة");
                    Logger.WriteLog("[" + DateTime.Now + "] ExceptionString: " + ex.ToString() + " InnerException: " + ex.InnerException + " ExceptionMessage: " + ex.Message + ". [" + this.Name + "] By [" + SessionInfo.empName + "]");
                }
            }
            else
            {
                MessageBox.Show("يوجد خطأ, اما انك لم تدخل بيانات العميل الجديد او أنك لم تدخل الرقم القومي للعميل القديم ");
            }
        }
 private void ControlPanel_Load(object sender, EventArgs e)
 {
     FunctionsClass fc = new FunctionsClass();
 }