示例#1
0
        private void FillTruck()
        {
            try
            {
                DataTable dtTrucks = JTruck.GetDataTable(0);
                //lsTrucks.DataSource = dtTrucks;
                //lsTrucks.DisplayMember = "FullName";
                //lsTrucks.ValueMember = "Code";
                _Shortcut = new string[dtTrucks.Rows.Count, 2];
                for (int i = 0; i < dtTrucks.Rows.Count; i++)
                {
                    _Shortcut[i, 0] = dtTrucks.Rows[i]["Code"].ToString();
                    _Shortcut[i, 1] = dtTrucks.Rows[i]["Shortcut"].ToString();
                }

                dtTrucks.Rows.Add(-1, " ", 0, DateTime.Now, DateTime.Now, "", " ");
                cmbTruck.DataSource    = dtTrucks;
                cmbTruck.DisplayMember = "FullName";
                cmbTruck.ValueMember   = "Code";
                //JProductss JCCs = new JProductss();
                //JCCs.SetComboBox(cmbProduct, 1);

                DataTable dtProduct = JProductss.GetDataTable();
                dtProduct.Rows.Add(-1, 901, "");
                dtProduct.Select("", "Code");
                cmbProduct.DataSource    = dtProduct;
                cmbProduct.DisplayMember = "Name";
                cmbProduct.ValueMember   = "Code";
            }
            catch (Exception ex)

            {
                JSystem.Except.AddException(ex);
            }
        }
示例#2
0
        private void Fill()
        {
            gridPlok.bind(JReport.GetPlok(), "Plok");

            cmbTruck.DataSource    = JTruck.GetDataTable(0);;
            cmbTruck.DisplayMember = "FullName";
            cmbTruck.ValueMember   = "Code";
        }
示例#3
0
        private void FillList()
        {
            DataTable tmpdt = JTruck.GetDataTable(0);

            JKeyValue[] M     = new JKeyValue[tmpdt.Rows.Count];
            int         count = 0;

            foreach (DataRow dr in tmpdt.Rows)
            {
                M[count]       = new JKeyValue();
                M[count].Key   = dr["Name"].ToString();
                M[count].Value = dr["Code"];
                count++;
            }
            chklistTrucks.Items.AddRange(M);

            tmpdt = JReport.GetBascols(0);
            JKeyValue[] B = new JKeyValue[tmpdt.Rows.Count];
            count = 0;
            foreach (DataRow dr in tmpdt.Rows)
            {
                B[count]       = new JKeyValue();
                B[count].Key   = dr["Code"].ToString();
                B[count].Value = dr["Code"];
                count++;
            }
            chkListBascol.Items.AddRange(B);

            tmpdt = JReport.GetUsersBascols(0);
            JKeyValue[] U = new JKeyValue[tmpdt.Rows.Count];
            count = 0;
            foreach (DataRow dr in tmpdt.Rows)
            {
                U[count]       = new JKeyValue();
                U[count].Key   = dr["Name"].ToString();
                U[count].Value = dr["Code"];
                count++;
            }
            chklistUsers.Items.AddRange(U);
            listUsers.Items.AddRange(U);

            tmpdt = JProductss.GetDataTable();
            JKeyValue[] T = new JKeyValue[tmpdt.Rows.Count];
            count = 0;
            foreach (DataRow dr in tmpdt.Rows)
            {
                T[count]       = new JKeyValue();
                T[count].Key   = dr["Name"].ToString();
                T[count].Value = dr["Code"];
                count++;
            }
            chklistTozin.Items.AddRange(T);
        }
示例#4
0
文件: Transfer.cs 项目: CoolWirya/BS
        public bool TransferAccess()
        {
            try
            {
                if (CreateConnectionServer())
                {
                    JMessages.Error(" ارتباط با بانک اصلی برقرار نمی شود ", "");
                    return(false);
                }
                ClassLibrary.JDataBase MyDB = new JDataBase(_Config);
                //ClassLibrary.JOLeDbDataBase MyDB = new ClassLibrary.JOLeDbDataBase();
                JWeights tmpWeights = new JWeights();
                //MyDB.setQuery(@"Select * From Weight");
                DataTable _DtAccess = tmpWeights.GetDataTable();
                DataTable _DtSQL;
                foreach (DataRow dr in _DtAccess.Rows)
                {
                    JWeight tmpWeight = new JWeight();
                    tmpWeight.TruckCode    = Convert.ToInt32(dr["TruckNo"]);
                    tmpWeight.UserPostCode = Convert.ToInt32(dr["UserPostCode"]);
                    tmpWeight.PersonCode   = Convert.ToInt32(dr["UserNo"]);
                    tmpWeight.pay          = Convert.ToInt32(dr["Pay"]);
                    tmpWeight.pay_h        = Convert.ToInt32(dr["pay_h"]);
                    tmpWeight.BascoolCode  = Convert.ToInt32(dr["BascoolCode"]);
                    tmpWeight.WDate        = Convert.ToDateTime(dr["WDate"]);
                    tmpWeight.WTime        = dr["WTime"].ToString();
                    tmpWeight.PlokNo       = dr["PlokNo"].ToString();
                    tmpWeight.Weights      = Convert.ToInt32(dr["Weights"]);
                    tmpWeight.Duty         = Convert.ToDecimal(dr["Duty"]); //(tmpWeight.pay / (100 + _Duty + _Tax)) * _Tax;
                    tmpWeight.Tax          = Convert.ToDecimal(dr["Tax"]);  //(tmpWeight.pay / (100 + _Duty + _Tax)) * _Duty;
                    tmpWeight.hamrahno     = Convert.ToInt32(dr["hamrahNo"]);
                    tmpWeight.ProductCode  = Convert.ToInt32(dr["ProductNo"]);

                    if (tmpWeight.Insert(MyDB) > 0)
                    {
                        tmpWeight.Delete(tmpWeight.Code);
                        MyDB.setQuery(@"Delete From Weight Where id = " + dr["Code"]);
                        if (MyDB.Query_Execute() <= 0)
                        {
                            JMessages.Error(" خطا در همگام سازی ", "");
                            return(false);
                        }
                    }
                }

                MyDB.setQuery(@"SELECT ID, WeightSerial, BascoolNo, DateWeight, EmptyWeight, WeightID  FROM EmptyTruck");
                _DtAccess = MyDB.Query_DataTable();
                foreach (DataRow dr in _DtAccess.Rows)
                {
                    JEmptyWeight tmpEmptyWeight = new JEmptyWeight();
                    tmpEmptyWeight.BascoolNo      = Convert.ToInt32(dr["BascoolNo"]);
                    tmpEmptyWeight.WeightID       = Convert.ToInt32(dr["WeightID"]);
                    tmpEmptyWeight.EmptyBascoolNo = Convert.ToInt32(dr["EmptyBascoolNo"]);
                    tmpEmptyWeight.WeightSerial   = Convert.ToInt32(dr["WeightSerial"]);
                    tmpEmptyWeight.DateWeight     = Convert.ToDateTime(dr["DateWeight"]);
                    tmpEmptyWeight.EmptyWeight    = Convert.ToInt32(dr["EmptyWeight"]);
                    tmpEmptyWeight.EmptyID        = Convert.ToInt32(dr["EmptyID"]);

                    if (tmpEmptyWeight.Insert() > 0)
                    {
                        MyDB.setQuery(@"Delete From Weight Where id = " + dr["Code"]);
                        if (MyDB.Query_Execute() <= 0)
                        {
                            JMessages.Error(" خطا در همگام سازی ", "");
                            return(false);
                        }
                    }
                }
                //  باسکول
                MyDB.setQuery(@" delete From Bascools ");
                if (MyDB.Query_Execute() > 0)
                {
                    foreach (DataRow dr1 in JReport.GetBascols(0).Rows)
                    {
                        MyDB.setQuery(@" Insert Into Bascools (" + dr1["Code"] + ",'" + dr1["Location"] + "'," + dr1["Capacity"] + ",'" + dr1["BDesc"] + "'," + dr1["Active"]);
                        if (MyDB.Query_Execute() <= 0)
                        {
                            return(false);
                        }
                    }
                }

                //  محصول
                MyDB.setQuery(@" delete From Product ");
                if (MyDB.Query_Execute() > 0)
                {
                    foreach (DataRow dr3 in JProductss.GetDataTable().Rows)
                    {
                        MyDB.setQuery(@" Insert Into Product (" + dr3["Code"] + ",'" + dr3["Name"] + "'");
                        if (MyDB.Query_Execute() <= 0)
                        {
                            return(false);
                        }
                    }
                }

                //  ماشینها
                MyDB.setQuery(@" delete From Truck ");
                if (MyDB.Query_Execute() > 0)
                {
                    foreach (DataRow dr2 in JTruck.GetDataTable(0).Rows)
                    {
                        MyDB.setQuery(@"INSERT INTO Truck(TruckId,Name,wp)values(" + dr2["Code"] + ",'" + dr2["Name"] + "'," + dr2["Price"] + ")");
                        if (MyDB.Query_Execute() <= 0)
                        {
                            return(false);
                        }
                    }
                }

                //
                MyDB.setQuery(@" delete From TaxFormula ");
                if (MyDB.Query_Execute() > 0)
                {
                    //GetTaxDuty();
                    //MyDB.setQuery(@"INSERT INTO (Duty, Tax) values(" + _Duty + "," + _Tax + ")");
                    if (MyDB.Query_Execute() <= 0)
                    {
                        return(false);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(false);
            }
        }