Exemplo n.º 1
0
 public InvoiceControlTankStockAdd()
 {
     InitializeComponent();
     txtTankNumber.Leave += new EventHandler(txtTankNumber_Leave);
        db=new GazOnDevEntities();
        button1.Enabled = false;
 }
        public InvoiceControlAccompanyStockAdd()
        {
            InitializeComponent();
               db=new GazOnDevEntities();

               comboBox1.DataSource = GetAccompanying_stocks();
        }
Exemplo n.º 3
0
        private void btnOpenTank_Click(object sender, EventArgs e)
        {
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                if (edit)
                {

                    db.Attach(newrecord);
                    db.ObjectStateManager.ChangeObjectState(newrecord, EntityState.Modified);

                }else
                {
                newrecord = new Tank_Stocks();
                newrecord.TankNumber = txtTankNumber.Text;
                newrecord.type = comboBox1.SelectedIndex.ToString();
                newrecord.Datetime = txtdate1.Text;
                newrecord.GazCompanyName = txtGazCompanyName.Text;
                newrecord.GazCompanyAddress = txtGazCompanyAddress.Text;
                newrecord.GazDistributor = txtGazDistributor.Text;
                if (!string.IsNullOrEmpty(txtYear_of_manufacture.Text))
                {
                    newrecord.Year_of_manufacture = Convert.ToInt32(txtYear_of_manufacture.Text);
                }
                newrecord.Date_of_Fix = Date_Of_Fix.Text;
                newrecord.manufacture_name = txtmanufacture_name.Text;
                if (!string.IsNullOrEmpty(txt_Tank_Size.Text))
                {
                    newrecord.Tank_Size = txt_Tank_Size.Text;
                }
                if (!string.IsNullOrEmpty(txtLabel_Number.Text))
                {
                newrecord.Label_Number =Convert.ToInt32(txtLabel_Number.Text);
                }
                newrecord.Address_Tank_From = txt_tank_fromAddress.Text;
                if (!string.IsNullOrEmpty(txtNumberOfZoklokPort.Text))
                {
                    newrecord.NumberOfZoklokPort = Convert.ToInt32(txtNumberOfZoklokPort.Text);
                 }
                newrecord.tankStatus = combotankStatus.SelectedIndex.ToString();
                newrecord.TankWithBase_baton = checkBox1.Checked ? true : false;
                // means that enabled at the stock
                newrecord.TankSystemStatus = "1";
                db.AddToTank_Stocks(newrecord);

                dbconf.tanknumber = (Convert.ToInt32(dbconf.tanknumber) + 1).ToString();
                db.Attach(dbconf);
                db.ObjectStateManager.ChangeObjectState(dbconf, EntityState.Modified);

                    }
                if (db.SaveChanges() > 0)
                {
                    MessageBox.Show("פעולת ההוספה הצליחה");

                }
                else
                {

                }
            }
        }
Exemplo n.º 4
0
        private void btnFinishFix_Click(object sender, EventArgs e)
        {
            if(tanktofix.Id >0)
            {
                using (GazOnDevEntities db=new GazOnDevEntities())
                {
                    tanktofix.TankSystemStatus = "1";

                    db.Tank_Stocks.Attach(tanktofix);
                    db.ObjectStateManager.ChangeObjectState(tanktofix, EntityState.Modified);

                    // newrecord.TankSystemStatus = "3";

                    if (db.SaveChanges() > 0)
                    {
                        MessageBox.Show("פעולת סיום שיפוץ הצליחה ");
                        //   btnOpenTank.Enabled = false;

                    }

                }

            }else
            {
                MessageBox.Show("נא לבחור צובר");
            }
        }
Exemplo n.º 5
0
 public TabkIntegrationBeforFix()
 {
     InitializeComponent();
     this.RightToLeft = Gizmox.WebGUI.Forms.RightToLeft.Yes;
     txtTankNumber.Leave += new EventHandler(txtTankNumber_Leave);
     using (GazOnDevEntities db = new GazOnDevEntities())
     {
         dbconf = db.Configdbs.FirstOrDefault();
         txtfixnumber.Text = dbconf.tankfixformnum;
       //  txtTankNumber.Text = dbconf.tanknumber;
     }
 }
Exemplo n.º 6
0
        public List<Accompanying_stocks> GetAccompanying_stocks()
        {
            List<Accompanying_stocks> _Accompanying_stocks = new List<Accompanying_stocks>();

            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                var query = from p in db.Accompanying_stocks select p;
                _Accompanying_stocks = query.ToList<Accompanying_stocks>();

            }
            return _Accompanying_stocks;
        }
Exemplo n.º 7
0
 private void button1_Click(object sender, EventArgs e)
 {
     // update
     selected.Count = txteditAmount.Text;
     using (GazOnDevEntities db = new GazOnDevEntities())
     {
         db.Attach(selected);
         db.ObjectStateManager.ChangeObjectState(selected, EntityState.Modified);
         db.SaveChanges();
         MessageBox.Show("נשמר בהצלחה ");
     }
     button1.Enabled = false;
 }
Exemplo n.º 8
0
        public TankInvoice()
        {
            InitializeComponent();

              dataGridView1.CellClick+=new DataGridViewCellEventHandler(dataGridView1_CellClick);
             dataGridView1.KeyDown +=new KeyEventHandler(dataGridView1_KeyDown);
             this.RightToLeft = Gizmox.WebGUI.Forms.RightToLeft.Yes;
            txtinvoiceid.Leave += new EventHandler(txtinvoiceid_Leave);
            txtTankNymber.Leave += new EventHandler(txtTankNymber_Leave);
            dataGridView1.AllowUserToAddRows = true;
            dataGridView1.ReadOnly = false;
            dataGridView1.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2;

             //dataGridView1.KeyDown+=new KeyEventHandler(dataGridView1_KeyDown);
             //dataGridView1.KeyPress += new KeyPressEventHandler(dataGridView1_KeyPress);
            using (GazOnDevEntities db= new GazOnDevEntities())
            {

                 dbconf= db.Configdbs.FirstOrDefault();
                txtinvoiceid.Text = dbconf.invoicelastid;

                var query = from p in db.Accompanying_stocks
                                 where p.isininvoice == true
                                 orderby p.invoiceorder ascending
                                 select p;
                List<Accompanying_stocks>  newstocklist = new List<Accompanying_stocks>(query.ToList<Accompanying_stocks>());
                Accompanying_stocks temp=new Accompanying_stocks();
                int k = 1;
                foreach (Accompanying_stocks item in newstocklist)
                { invoiceitem invitm=new invoiceitem();
                    invitm.invoiceid =txtinvoiceid.Text;
                     invitm.title =item.Title;
                     invitm.type = "stock";
                     invitm.typeid = item.Id.ToString();
                     invitm.num = k.ToString();
                     k++;
                     _currentinvoiceitems.Add(invitm);

                }

                bindingSource1.DataSource = _currentinvoiceitems;
                //stocklist.Add(temp);
                //stocklist.Add(temp);

                // must icrease id of invoice id  ;
            }

              //  textBox1.Leave += new EventHandler(textBox1_Leave);
        }
Exemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (GazOnDevEntities db =new GazOnDevEntities())
            {

                user dd = db.users.FirstOrDefault(x => x.username == textBox1.Text && x.password == maskedTextBox1.Text);

                if (dd.id > 0)
                {
                    Session["isloged"] = "true";
                    if (Convert.ToBoolean(dd.isadmin)) Session["isadmin"] = "true";
                    this.Context.Redirect("MainForm.wgx");
                }

            }
        }
Exemplo n.º 10
0
 private void button1_Click(object sender, EventArgs e)
 {
     // update
     selected.lastname = txtEditlastname.Text;
     selected.firstname = txtEditFirstname.Text;
     selected.username = txtEditusername.Text;
     selected.password = txtEditpassword.Text;
     selected.isadmin = chknewadmin.Checked;
     using (GazOnDevEntities db = new GazOnDevEntities())
     {
         db.Attach(selected);
         db.ObjectStateManager.ChangeObjectState(selected, EntityState.Modified);
         db.SaveChanges();
         MessageBox.Show("נשמר בהצלחה ");
     }
     button1.Enabled = false;
 }
Exemplo n.º 11
0
        private void btnOpenTank_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("הוספת פריט למלאי נלווה");
            using (GazOnDevEntities db=new GazOnDevEntities())
            {
                Accompanying_stocks newrecord = new Accompanying_stocks();
                newrecord.Count = txtStockAmount.Text;
                newrecord.Title = txtStockTitle.Text;
                db.AddToAccompanying_stocks(newrecord);
               int result = db.SaveChanges();
               if (result > 0)
               {
                   MessageBox.Show("פריט התווסף למלאי בהצלחה "+result);
               }

            }
        }
Exemplo n.º 12
0
        private void btnOpenTank_Click(object sender, EventArgs e)
        {
            //MessageBox.Show("הוספת פריט למלאי נלווה");
            using (GazOnDevEntities db=new GazOnDevEntities())
            {
                user newrecord = new user();
                newrecord.lastname = txtNewlastname.Text;
                newrecord.firstname = txtNewFirstname.Text;
                newrecord.username = txtNewusername.Text;
                newrecord.password = txtNewpass.Text;
                newrecord.isadmin = chknewadmin.Checked;
                db.AddTousers(newrecord);
               int result = db.SaveChanges();
               if (result > 0)
               {
                   MessageBox.Show("  פעולה הצליחה  ");
                   btnOpenTank.Enabled = false;
               }

            }
        }
Exemplo n.º 13
0
        /*  BindingSource _bsTankOpen;
        GazOnDevEntities db2 = new GazOnDevEntities();*/
        public TabkOpen()
        {
            InitializeComponent();
            this.RightToLeft = Gizmox.WebGUI.Forms.RightToLeft.Yes;

               // _bsTankOpen = new BindingSource(typeof(Tank_Stocks), "");

            txtTankNumber.Leave += new EventHandler(txtTankNumber_Leave);

             Tank_Stocks tanktofix;
             BindingList<invoiceitem> _currentinvoiceitems = new BindingList<invoiceitem>();
             Invoice _currentinvoice = new Invoice();

            using (GazOnDevEntities db= new GazOnDevEntities())
            {

                 dbconf= db.Configdbs.FirstOrDefault();
                txtTankNumber.Text = dbconf.tanknumber;
                // must icrease id of invoice id  ;
            }
              //  textBox1.Leave += new EventHandler(textBox1_Leave);
        }
Exemplo n.º 14
0
        private void updateStockAmount(invoiceitem item)
        {
            using (GazOnDevEntities db=new GazOnDevEntities())
            {
                int idd=Convert.ToInt32(item.typeid);
                Accompanying_stocks tepstock = db.Accompanying_stocks.SingleOrDefault(x => x.Id == idd);

                int amount= Convert.ToInt32(tepstock.Count) - Convert.ToInt32(item.amount);
                tepstock.Count = amount.ToString();
                var entry = db.ObjectStateManager.GetObjectStateEntry(tepstock);
                if (entry.State == EntityState.Detached)
                {
                    // Do Something
                    db.Attach(tepstock);
                }

                db.ObjectStateManager.ChangeObjectState(tepstock, EntityState.Modified);
                db.SaveChanges();

            }
        }
Exemplo n.º 15
0
        void txtTankNymber_Leave(object sender, EventArgs e)
        {
            bool error = false;

             if (!string.IsNullOrEmpty(txtTankNymber.Text))
             {
                 using (GazOnDevEntities db = new GazOnDevEntities())
                 {
                     tanktofix = db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == txtTankNymber.Text);
                 }
                 if (null == tanktofix)
                 {
                     MessageBox.Show("לא קיים מספר צובר כזה ");
                     return;

                 }
                 if (!string.IsNullOrEmpty(tanktofix.invoiceid))
                 {
                     MessageBox.Show("צובר עם מספר זה  מקושר כבר לתעןדת משלוח  מס  " + tanktofix.invoiceid);
                     return;
                 }

                 if (tanktofix.Id < 1)
                 {
                     error = true;
                 }
             }
             else
             {
                 error = false;

             }

             if (error)
             {
                 MessageBox.Show("לא קיים מספר צובר כזה ");
             }
             else
             {
              //   button1.Enabled = true;

                 if (tanktofix != null)
                 {
                     txtTankDescription.Text = "צובר " + tanktofix.Tank_Size + " גלון מספר " + tanktofix.TankNumber + "";
                 }

             }
        }
Exemplo n.º 16
0
        void txtinvoiceid_Leave(object sender, EventArgs e)
        {
            using (GazOnDevEntities db = new GazOnDevEntities())
             {
                 _currentinvoice = db.Invoices.FirstOrDefault(x => x.invoiceNumber == txtinvoiceid.Text);
                 if ((null != _currentinvoice) && (_currentinvoice.id > 0))
                 {
                     edit = true;
                     MessageBox.Show("תעודת משלוח עם מספר כזה קיימת  אתה עובר למצב עריכה");
                   //  havetank = Convert.ToBoolean(_currentinvoice.havetank);
                     // set buttun to disable
                     //button1.Enabled = false;
                     //btnReportPrint.Enabled = false;
                     //btnPrint.Enabled = false;
                     //btnupload.Enabled = false;
                     //foreach (Control item in dataGridView1.Controls)
                     //{
                     //    item.Enabled = false;

                     //}

                     txtAddress.Text = _currentinvoice.address;
                     txtTo.Text = _currentinvoice.C_to;
                     txtCarNum.Text = _currentinvoice.carnum;
                     DatetimePicker.Value = Convert.ToDateTime(_currentinvoice.date);
                     txtinvoiceid.Text = _currentinvoice.invoiceNumber;
                     txtCarTransporter.Text = _currentinvoice.transporter;
                     txtTankNymber.Text = _currentinvoice.tankNumber;
                     txtTankDescription.Text = _currentinvoice.tankDesc;
                     // increase invoice id number

                     var query = from p in db.invoiceitems
                                 where p.invoiceid == txtinvoiceid.Text
                                 orderby p.id ascending
                                 select p;
                     _currentinvoiceitems = new BindingList<invoiceitem>(query.ToList<invoiceitem>());

                     bindingSource1.DataSource =_currentinvoiceitems;

                 }
                 else
                 {

                 // set buttns to enable
                     edit = false;
                        //btnReportPrint.Enabled = true;
                        // btnPrint.Enabled = true;
                        // btnupload.Enabled = true;
                        // button1.Enabled = true;
                        // havetank = false;
                        // foreach (Control item in dataGridView1.Controls)
                        // {
                        //     item.Enabled = true;

                        // }

                 }
             }
        }
Exemplo n.º 17
0
        private void btnReportPrint_Click(object sender, EventArgs e)
        {
            using (GazOnDevEntities db = new GazOnDevEntities())
            {

                if (edit)
                {
                    db.Attach(_currentinvoice);
                    db.ObjectStateManager.ChangeObjectState(_currentinvoice, EntityState.Modified);

                    foreach (invoiceitem item in bindingSource1.List)
                    {
                        if (null != item.amount)
                        {
                            updateStockAmount(item);
                        }
                        db.Attach(item);
                        db.ObjectStateManager.ChangeObjectState(item, EntityState.Modified);
                    }
                }
                else
                {

                    foreach (invoiceitem item in bindingSource1.List)
                    {
                        //invoiceitem item = new invoiceitem();
                        ////stocklist.
                        // item.invoiceid = txtinvoiceid.Text;

                        if (null != item.amount)
                        {
                            updateStockAmount(item);
                        }
                        db.AddToinvoiceitems(item);
                    }
                }

                //}

                dbconf.invoicelastid = (Convert.ToInt32(dbconf.invoicelastid) + 1).ToString();
                db.Attach(dbconf);
                db.ObjectStateManager.ChangeObjectState(dbconf, EntityState.Modified);

                if (edit)
                {

                }
                else
                {
                    if (_currentinvoice == null)
                    {
                        _currentinvoice = new Invoice();
                    }
                    _currentinvoice.address = txtAddress.Text;
                    _currentinvoice.C_to = txtTo.Text;
                    _currentinvoice.carnum = txtCarNum.Text;
                    _currentinvoice.date = DatetimePicker.Value;
                    _currentinvoice.invoiceNumber = txtinvoiceid.Text;
                    _currentinvoice.tankNumber = tanktofix.TankNumber;
                    _currentinvoice.tankDesc = txtTankDescription.Text;
                    // increase invoice id number
                    _currentinvoice.transporter = txtCarTransporter.Text;
                    db.AddToInvoices(_currentinvoice);
                }
                if (db.SaveChanges() > 0)
                {

                    // MessageBox.Show("פעולת ההוספה הצליחה");
                    frmReportTankRecipet tanko = new frmReportTankRecipet(Convert.ToInt32(_currentinvoice.invoiceNumber), "report3");
                    tanko.ShowDialog();
                    //btnOpenTank.Enabled = false;

                }
                else
                {
                    MessageBox.Show("פעולת ההוספה נכשלה");

                }
            }
              //  btnOpenTank.Enabled = false;
              /*  frmReportTankRecipet tanko = new frmReportTankRecipet(tanktofix.Id, "report3");
            tanko.ShowDialog();*/
        }
Exemplo n.º 18
0
        private void FilllsvwlsvwStock()
        {
            lsvwStock.Items.Clear();
            if (string.IsNullOrEmpty(txttanknumber.Text))
            {
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                    var query = from p in db.Accompanying_stocks
                                orderby p.Id ascending
                                select p;
                    _listoflsvwStock = new BindingList<Accompanying_stocks>(query.ToList<Accompanying_stocks>());

                }
            }

            foreach (Accompanying_stocks item in _listoflsvwStock)
            {

                ListViewItem objItem = null;

                objItem = this.lsvwStock.Items.Add(item.Title);
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }

                Index++;

                objItem.SubItems.Add(item.Count );

            }
        }
Exemplo n.º 19
0
        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {
            OpenFileDialog objOFD = sender as OpenFileDialog;
            if (sender == null || objOFD.Files == null || objOFD.Files.Count == 0)
            {
            return;
            }

            Gizmox.WebGUI.Common.Resources.FileHandle objFile = null;
            if (objOFD.Files[0] == null || !(objOFD.Files[0] is Gizmox.WebGUI.Common.Resources.FileHandle))
            {
            return;
            }

            // Display original file name, of the first uploaded file, on a label.

            string newguid = Guid.NewGuid().ToString();
            string path = ConfigurationManager.AppSettings["uploadfilepath"].ToString() +newguid;

            DirectoryInfo objDirectoryInfo = Directory.CreateDirectory(path);

            for (int intIndex = 0; intIndex < objOFD.Files.Count; intIndex++)
            {
            objOFD.Files[intIndex].SaveAs(Path.Combine(objDirectoryInfo.FullName,
                                                   ((Gizmox.WebGUI.Common.Resources.HttpPostedFileHandle)(objOFD.Files[intIndex])).PostedFileName));
            objFile = objOFD.Files[intIndex] as Gizmox.WebGUI.Common.Resources.FileHandle;
            LinkLabel linkLabel1 = new LinkLabel();
            linkLabel1.Text = objFile.OriginalFileName;
            linkLabel1.Url = "files/" + newguid + "/" + objFile.OriginalFileName;

            flowLayoutPanel1.Controls.Add(linkLabel1);

            // ad values to database
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
            UploadedFilesOftank newfile = new UploadedFilesOftank();
            newfile.filename = objFile.OriginalFileName;
            newfile.filepath = "files/" + newguid + "/" + objFile.OriginalFileName;
            newfile.tankfixid = tanktofix.Id.ToString();
            db.AddToUploadedFilesOftanks(newfile);
            db.SaveChanges();
            }
            }
        }
Exemplo n.º 20
0
        private void button1_Click(object sender, EventArgs e)
        {
            // update

            int newamount = Convert.ToInt32(txteditAmount.Text) + Convert.ToInt32(txteditAmountCurrent.Text);

            selected.Count = newamount.ToString();
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                db.Attach(selected);
                db.ObjectStateManager.ChangeObjectState(selected, EntityState.Modified);
                db.SaveChanges();
                MessageBox.Show("נשמר בהצלחה ");
                txteditAmount.Text = "";
                //comboBox1.SelectedIndex = comboBox1.Items.IndexOf(selected);
                comboBox1.SelectedIndex = comboBox1.FindStringExact(selected.Title);
            }
            button1.Enabled = false;
        }
Exemplo n.º 21
0
        private void FilllsvwlsvwFixingTanks()
        {
            this.lsvwFixingTanks.Items.Clear();
            if (string.IsNullOrEmpty(txttanknumber.Text))
            {
                using (GazOnDevEntities db = new GazOnDevEntities())
                {
                    var query = from p in db.Tank_Stocks
                                where p.TankSystemStatus == "3"
                                orderby p.Id ascending
                                select p;
                    _ListlsvwFixingTanks = new BindingList<Tank_Stocks>(query.ToList<Tank_Stocks>());

                }
            }

            foreach (Tank_Stocks item in _ListlsvwFixingTanks)
            {

                ListViewItem objItem = null;

                string tankTitle="צובר "+item.Tank_Size+" גלון מספר "+item.TankNumber+"";
                objItem = this.lsvwFixingTanks.Items.Add(item.TankNumber);
                if ((Index % 2) == 0)
                {
                    objItem.BackColor = Color.AntiqueWhite;
                }
                else
                {
                    objItem.BackColor = Color.Azure;
                }

                Index++;
                objItem.SubItems.Add(tankTitle);

                objItem.SubItems.Add(item.manufacture_name );
                objItem.SubItems.Add(item.Datetime);
                objItem.SubItems.Add(item.GazCompanyName);
                objItem.SubItems.Add(item.GazDistributor);

            }
        }
Exemplo n.º 22
0
        void txteditmakat_Leave1(object sender, EventArgs e)
        {
            //txteditmakat
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                selected = db.Accompanying_stocks.FirstOrDefault(x => x.makat == textmakat.Text);
                //  comboBox1.sele = selected.
                //comboBox1.FindStringExact(selected.Title)
                if (null != selected)
                {

                if (comboBox1.FindStringExact(selected.Title) >0 )
                {
                    comboBox1.SelectedIndex = comboBox1.FindStringExact(selected.Title);
                    MessageBox.Show("הפריט קיים במלאי אתה מועבר למצב עריכה");
                }
                }
               // comboBox1.Items

            }
        }
Exemplo n.º 23
0
        void txteditmakat_Leave(object sender, EventArgs e)
        {
            //txteditmakat
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                selected = db.Accompanying_stocks.FirstOrDefault(x => x.makat == txteditmakat.Text);
                //  comboBox1.sele = selected.
                //comboBox1.FindStringExact(selected.Title)
                comboBox1.SelectedIndex = comboBox1.FindStringExact(selected.Title);

            }
        }
Exemplo n.º 24
0
        private void updateTankStock(string tankids,string invoicenumber)
        {
            int tankid = Convert.ToInt32(tankids);

            //  update tankstock
            using (GazOnDevEntities db = new GazOnDevEntities())
            {

                Tank_Stocks edittank = db.Tank_Stocks.SingleOrDefault(x => x.Id == tankid);
                edittank.invoiceid = invoicenumber;
                if (string.IsNullOrEmpty(invoicenumber))
                {
                    edittank.TankSystemStatus = "1";
                }
                else
                {
                    edittank.TankSystemStatus = "4";
                }
                //db.Tank_Stocks.Attach(edittank);
                db.ObjectStateManager.ChangeObjectState(edittank, EntityState.Modified);
                db.SaveChanges();

            }
        }
Exemplo n.º 25
0
        private void FillUploadLinks(int tankfixid)
        {
            string idoftank = tankfixid.ToString();
            // ad values to database
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                var query = from a in db.UploadedFilesOftanks
                            where a.tankfixid == idoftank
                            select a;
                if(null != query)
                {

              List<UploadedFilesOftank> allfiles=   query.ToList<UploadedFilesOftank>();
              foreach (var item in allfiles)
              {

                  LinkLabel linkLabel1 = new LinkLabel();
                  linkLabel1.Text = item.filename;
                  linkLabel1.Url = item.filepath;
                  flowLayoutPanel1.Controls.Add(linkLabel1);
              }
            }

            }
        }
Exemplo n.º 26
0
        void txtTankNumber_Leave(object sender, EventArgs e)
        {
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                newrecord = db.Tank_Stocks.FirstOrDefault(x => (x.TankNumber == txtTankNumber.Text));
                if (null == newrecord) return;
                if (newrecord.Id > 0)
                {
                    if (newrecord.TankSystemStatus == "1")
                    {

                        MessageBox.Show("צובר קיים במערכת אתה עובר למצב עריכה ");
                        edit = true;
                    }
                    if (newrecord.TankSystemStatus == "2")
                    {
                        MessageBox.Show("צובר קיים במערכת בסטאטוס המתנה לשיפוץ אי אפשר להביא את הנתונים שלו מכאן נא לגשת לניתוב או לטופס קליטה לשיפוץ ");
                        txtTankNumber.Text = "";
                        txtTankNumber.Focus();
                        return;
                    }
                    if (newrecord.TankSystemStatus == "3")
                    {
                        MessageBox.Show("צובר קיים במערכת אבל הוא בשיפוץ אי אפשר להביא את הנתונים שלו מכאן נא לגשת  לטופס שיפוץ ");
                        txtTankNumber.Text = "";
                        txtTankNumber.Focus();
                        return;
                    }

                }
                else
                {
                    // MessageBox.Show(" אין צובר עם המספר הזה ");
                    // true צובר חדש
                    edit = false;
                }

                // newrecord = db.Tank_Stocks.FirstOrDefault(x =>( x.TankNumber == txtTankNumber.Text) &&(x.TankSystemStatus=="1"));
                if (null != newrecord)
                {

                    txtTankNumber.Text = newrecord.TankNumber;
                    //comboBox1.SelectedIndex = comboBox1.FindCode(newrecord.type);
                    if (!string.IsNullOrEmpty(newrecord.type))
                    {
                        comboBox1.SelectedIndex = Convert.ToInt32(newrecord.type);
                    }

                    txtdate1.Text = newrecord.Datetime;
                    txtGazCompanyName.Text = newrecord.GazCompanyName;
                    txtGazCompanyAddress.Text = newrecord.GazCompanyAddress;
                    txtGazDistributor.Text = newrecord.GazDistributor;
                    if (null != newrecord.Year_of_manufacture)
                    {
                        txtYear_of_manufacture.Text = newrecord.Year_of_manufacture.ToString();
                    }
                    Date_Of_Fix.Text = newrecord.Date_of_Fix;
                    txtmanufacture_name.Text = newrecord.manufacture_name;
                    if (null != newrecord.Tank_Size)
                    {
                        txt_Tank_Size.Text = newrecord.Tank_Size.ToString();
                    }
                    if (null != newrecord.Label_Number)
                    {
                        txtLabel_Number.Text = newrecord.Label_Number.ToString();
                    }
                    txt_tank_fromAddress.Text = newrecord.Address_Tank_From;
                    if (null != newrecord.NumberOfZoklokPort)
                    {
                        txtNumberOfZoklokPort.Text = newrecord.NumberOfZoklokPort.ToString();
                    }
                    if (null != newrecord.tankStatus)
                    {
                        combotankStatus.SelectedIndex = Convert.ToInt32(newrecord.tankStatus);
                    }
                    checkBox1.Checked = (bool)newrecord.TankWithBase_baton;
                    edit = true;
                }
            }
        }
Exemplo n.º 27
0
        void textBox1_Leave(object sender, EventArgs e)
        {
            // get details of the gaz tank
            btnFinishFix.Enabled = true;
            btnOpenTank.Enabled = true;
            bool error = false;
            using (GazOnDevEntities db=new GazOnDevEntities())
            {

                if(!string.IsNullOrEmpty(textBox1.Text))
                {

                    tanktofix = db.Tank_Stocks.FirstOrDefault(x => (x.TankNumber == textBox1.Text) && ((x.TankSystemStatus == "2") || (x.TankSystemStatus == "3") || (x.TankSystemStatus == "1") || (x.TankSystemStatus == "4")));
                    if (null == tanktofix)
                    {
                        MessageBox.Show("לא קיים מספר צובר כזה שהקלט לשיפוץ");
                        return;

                    }
                  if (tanktofix.Id < 1)
                  {
                      error = true;
                  }
                }else
                {
                    error = false;

                }

                if (error)
                {
                    MessageBox.Show("לא קיים מספר צובר כזה שהקלט לשיפוץ");
                }
                else
                {
                    if ((tanktofix.TankSystemStatus == "1") || (tanktofix.TankSystemStatus == "4"))
                    {
                        if (tanktofix.TankSystemStatus == "4")
                        {
                         MessageBox.Show("אתה צופה בצובר שיצא מהמלאי נא לא  לערוך ");
                        }
                        else
                        {
                            MessageBox.Show("אתה צופה בצובר שקיים במלאי נא לא  לערוך ");
                        }
                        btnFinishFix.Enabled = false;
                        btnOpenTank.Enabled = false;

                    }
                    else
                    {
                        btnFinishFix.Enabled = true;
                        btnOpenTank.Enabled = true;
                    }
                    flowLayoutPanel1.Controls.Clear();
                    txt_Tank_Size.Text = tanktofix.Tank_Size.ToString();
                    txt_Tank_Size.Enabled = false;
                    txtmanufacture_name.Text = tanktofix.manufacture_name;
                    txtmanufacture_name.Enabled = false;
                    txtYear_of_manufacture.Text= tanktofix.Year_of_manufacture.ToString();
                    txtYear_of_manufacture.Enabled = false;
                    comboBox1.SelectedIndex =Convert.ToInt32(tanktofix.tankStatus);

                    txtDate1.Text = tanktofix.Datetime;
                    txtorderingName.Text = tanktofix.GazCompanyName;
                    comboBox1.Enabled = false;
                    FillListView(tanktofix.Id);
                    FillUploadLinks(tanktofix.Id);

                }

            }
        }
Exemplo n.º 28
0
        private void Find_Tank()
        {
            /*
              _ListlsvwTank
                               _listoflsvwWaitingTanks
                _ListlsvwFixingTanks;_ListlsvwStockTanks; _listoflsvwStock;_listoflsvwInvoices
             */
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                selected =db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == txttanknumber.Text);
                switch (selected.TankSystemStatus)
                {
                    case "1" :

                        _ListlsvwStockTanks.Add(selected);
                    //FIND A     //במלאי
                    break;
                    case "2" : //ממתין לשיפוץ
                    _listoflsvwWaitingTanks.Add(selected);
                break;
                    case "3": //בשיפוץ
                _ListlsvwFixingTanks.Add(selected);
                break;
                    case "4": //יצא לתעודת משלוח
                 _ListlsvwTank.Add(selected);
                break;

                }
            }
        }
Exemplo n.º 29
0
        private void btnOpenTank_Click(object sender, EventArgs e)
        {
            using (GazOnDevEntities db = new GazOnDevEntities())
            {
                TankFixOperation newtankfixoperationrecord = new TankFixOperation();

                newtankfixoperationrecord.tankID = tanktofix.Id;
                 db.TankFixOperations.Where(x=>x.tankID == tanktofix.Id ).ToList().ForEach(db.TankFixOperations.DeleteObject);
                 db.SaveChanges();
                List<TankFixOperation> _opList = new List<TankFixOperation>();
                foreach (ListViewItem item in Listview1.mobjListView.Items)
                    {
                        TankFixOperation row = new TankFixOperation();
                        row.tankID = tanktofix.Id;
                    //ITERATE THROUGHT listview and save values to database tankFixoperation
                        if (!string.IsNullOrEmpty(item.SubItems[1].ToString()))
                        {
                            row.amount = Convert.ToInt32(item.SubItems[1].ToString());
                        }
                        if (!string.IsNullOrEmpty(item.SubItems[0].ToString()))
                        {
                            row.title = item.SubItems[0].ToString();
                        }
                        if (!string.IsNullOrEmpty(item.SubItems[2].ToString()))
                        {
                            row.date = Convert.ToDateTime(item.SubItems[2].ToString());
                        }
                        else
                        {
                            row.date = null;
                        }
                        if (!string.IsNullOrEmpty(item.SubItems[3].ToString()))
                        {
                            row.note = item.SubItems[3].ToString();
                        }

                        _opList.Add(row);
                        db.AddToTankFixOperations(row);
                  //      MessageBox.Show("Title" + item.SubItems[0].ToString());

                    }
                // הסתיים שיפוץ אזי יופיע במלאי
                tanktofix.TankSystemStatus = "3";

                db.Tank_Stocks.Attach(tanktofix);
                db.ObjectStateManager.ChangeObjectState(tanktofix, EntityState.Modified);
                 // db.Tank_Stocks.FirstOrDefault(x => x.TankNumber == textBox1.Text)
                //Tank_Stocks newrecord = new Tank_Stocks();
                //newrecord.TankNumber = txtorderingName.Text;
                //newrecord.type = comboBox1.SelectedIndex.ToString();
                //newrecord.Datetime = dateTimePicker1.Value;
            //this is a status of fixing progress

               // newrecord.TankSystemStatus = "3";

                if (db.SaveChanges() > 0)
                {
                    MessageBox.Show("פעולת ההוספה הצליחה");
                 //   btnOpenTank.Enabled = false;

                }
                else
                {

                }
            }
        }
Exemplo n.º 30
0
        public void renderrep(int tankid)
        {
            using (GazOnDevEntities db =new GazOnDevEntities())
            {

                var query1 = from i in db.Tank_Stocks
                             where i.Id == tankid
                             select i;
               Tank_Stocks dd = query1.FirstOrDefault();

                var query2 = from i in db.TankFixOperations
                             where i.tankID == tankid
                             select i;

                //  dd.FirstOrDefault().Datetime = Convert.ToDateTime(dd.FirstOrDefault().Datetime.Value.ToString("MM/dd/yyyy"));
                //dd.FirstOrDefault().Date_of_Fix = Convert.ToDateTime(dd.FirstOrDefault().Date_of_Fix.Value.ToString("MM/dd/yyyy"));

                   List<TankFixOperation> ds2 = query2.ToList<TankFixOperation>();

              //  int personSigned = Convert.ToInt32(query1.FirstOrDefault().PersonRecipetsignid);
                // int transportCompanyid = Convert.ToInt32(query1.FirstOrDefault().TransportCompanyID);
                 this.reportViewer1.LocalReport.DataSources.Clear();
                // this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dd));
                 this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet2", ds2));
              //     SignPerson personrecipet=   db.SignPersons.FirstOrDefault(x=>x.id == personSigned);
                //  TransportCompany companytrans=   db.TransportCompanies.FirstOrDefault(x=>x.id == transportCompanyid);
                // ReportDataSource rds = new ReportDataSource("DataSet1", dd);
               //  this.reportViewer1.LocalReport.DataSources = dd;

                 string tanktype =string.Empty;
                if(dd.type == "0")
                {
                tanktype ="קרקעי";
                }
                if (dd.type == "1")
                {
                    tanktype = "עילי";
                }
                if (dd.type == "2")
                {
                    tanktype = "עילי עובר לתת";

                }
                if (dd.type == "3")
                {
                    tanktype = "שינויים";
                }

                 ReportParameter p1 = new ReportParameter("manufacture_name", dd.manufacture_name);
                 ReportParameter p2 = new ReportParameter("Datetime", dd.Datetime);
                 ReportParameter p3 = new ReportParameter("Tank_Size", dd.Tank_Size.ToString());
                 ReportParameter p4 = new ReportParameter("type", tanktype);
                ReportParameter p5 = new ReportParameter("FixNum", dd.TankFixNumber);
                ReportParameter p6 = new ReportParameter("Year_of_manufacture", dd.Year_of_manufacture.ToString());
                ReportParameter p7 = new ReportParameter("TankNumber", dd.TankNumber);
                ReportParameter p8 = new ReportParameter("OrderName", dd.GazCompanyName );
                ReportParameter p9 = new ReportParameter("DatetimeNow", DateTime.Now.ToString("MM/dd/yyyy"));

                reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, p3,p4,p5,p6,p7,p8 });

                this.reportViewer1.DataBind();
                reportViewer1.LocalReport.Refresh();
              //  this.reportViewer1.Reset();

               //     this.reportViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
                 //ReportDataSource rds = new ReportDataSource("DataSet1",AllFamilies.GetAllProjects);
                 //this.reportViewer1.LocalReport.DataSources = AllFamilies.GetAllProjects;

            }

            /* DataSet Data = new DataSet();
               Data.ReadXml(this.Context.Server.MapPath(ReportPath + "data.xml"));*/

            //if (MSMODE.Checked)
            //{
            //    Report.Render(Reporting.ReportViewer.RenderType.MSReportViewer, ReportPath, ReportName, ReportName, new ReportDataSource("Sales", Data.Tables[0]));
            //    MessageBox.Show("MS ReportViewer 2010 VWG support is broken -> IFrame Bug, Scriptmanager");
            //}
            //else
            //{
            //  Report.Render(Reporting.ReportViewer.RenderType.PDFReportViewer, ReportPath, ReportName, ReportName, new ReportDataSource("Sales", Data.Tables[0]));
            //}

            // this.Report..LocalReport.DataSources.Clear();
            //this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetMoslemFamily", ListFamilyMoslemproj));
            //this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetFoodBox", ListFoodBoxmproj));
            //this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetPerson", ListPerson));
            //this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetHomeFix", ListHomeFix));
            //this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetSchoolBags", ListSchoolBags));

            //this.reportViewer1.Reset();

            //this.reportViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
            // ReportDataSource rds = new ReportDataSource("DataSet1",AllFamilies.GetAllProjects);
            // this.reportViewer1.LocalReport.DataSources = AllFamilies.GetAllProjects;

            //this.reportViewer1.DataBind();
            // reportmoslemFamilyProjectBindingSource.DataSource = AllFamilies.GetAllProjects;
            // Below code demonstrate the Parameter passing method. Use only if you have parameters into the reports.

            //ReportParameter p1 = new ReportParameter("FullName", currentPerson.FirstName + " " + currentPerson.FatherName + " " + currentPerson.LastName);
            //ReportParameter p2 = new ReportParameter("PersonID", currentPerson.IDnum);

            //reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2 });
            //reportViewer1.Visible = true;
        }