Ejemplo n.º 1
0
 public void imprimir()
 {
     XtraMessageBox.Show("NO SE PUEDE IMPRIMIR UN DOCUMENTO PENDIENTE");
 }
 public static DialogResult Error(string message)
 {
     return(XtraMessageBox.Show("Lỗi: " + message, "Quản lý đạo tạo AGU",
                                MessageBoxButtons.OK, MessageBoxIcon.Error));
 }
Ejemplo n.º 3
0
 public void generarXML()
 {
     XtraMessageBox.Show("NO SE PUEDE Generar el archivo XML");
 }
Ejemplo n.º 4
0
        private void themThietBi()
        {
            bool show = true;
            bool open = false;
            Guid id   = Guid.Empty;

            try
            {
                List <ThietBi> list = new List <ThietBi>();
                list = _ucQuanLyThietBi.getListThietBi();
                if (list != null && list.Count > 0)
                {
                    foreach (ThietBi obj in list)
                    {
                        if (obj != null)
                        {
                            if (!yestoall)
                            {
                                frmTinhTrangVaSoLuong frm = new frmTinhTrangVaSoLuong(loaichung);
                                frm.Text += " " + obj.ten;
                                frm.setTinhTrangAndSoLuong = new frmTinhTrangVaSoLuong.SetTinhTrangAndSoLuong(setTinhTrangAndSoLuong);
                                if (!frm.ShowDialog().Equals(System.Windows.Forms.DialogResult.No))
                                {
                                    text = "";
                                    id   = AddObj(obj, objTinhTrang, SoLuong, GhiChu);
                                    if (!yestoall)
                                    {
                                        showToolTip(text);
                                    }
                                    if (reLoadAndFocused_phong_thietbi != null && id != Guid.Empty)
                                    {
                                        reLoadAndFocused_phong_thietbi(id);
                                    }
                                }
                            }
                            else
                            {
                                if (show)
                                {
                                    DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                                    DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Đang xử lý...");
                                    open = true;
                                    show = false;
                                }
                                Guid id2 = AddObj(obj, objTinhTrang, SoLuong, GhiChu);
                                id = id2 != Guid.Empty ? id2 : id;
                            }
                        }
                    }
                    if (reLoadAndFocused_phong_thietbi != null && yestoall)
                    {
                        reLoadAndFocused_phong_thietbi(id);
                    }
                    _ucQuanLyThietBi.loadData(loaichung);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(this.Name + "->themThietBi: " + ex.Message);
                XtraMessageBox.Show("Lỗi khi thêm thiết bị vào phòng!");
            }
            finally
            {
                if (open)
                {
                    DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(false);
                }
                if (yestoall)
                {
                    showToolTip(text);
                    yestoall = false;
                }
            }
        }
Ejemplo n.º 5
0
        private void BtnLoginClick(object sender, EventArgs e)
        {
            UserInformation userInfo = null;

            try
            {
                if (BLL.Settings.UseNewUserManagement)
                {
                    userInfo = Auth.Authenticate(txtUsername.Text, txtPassword.Text);
                    if (userInfo == null)
                    {
                        //errorLogger.SaveError(0, 1, 1, 2, "Login Attempt", "Warehouse", new InvalidCredentialException("Invalid credentials, Username = "******"", "", true, txtUsername.Text, Program.HCMISVersionString);
                    if (XtraMessageBox.Show(@"Invalid Username or Password!", @"Login Failed", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.Cancel)
                    {
                        Application.Exit();
                    }
                    else
                    {
                    }
                }
            }
            catch
            {
                if (System.Diagnostics.Debugger.IsAttached)
                {
                    //ConnectionStringManager.ConnectionStringManager connMgr =
                    //    new ConnectionStringManager.ConnectionStringManager(Program.RegKey,
                    //                                                        Program.PrevConnectionStringKey);
                    //connMgr.ShowDialog();
                }
                else
                {
                    XtraMessageBox.Show("Network error.  Please make sure your network connection is working.", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            // Clear the login form
            txtPassword.Text = "";
            txtUsername.Text = "";
            txtUsername.Focus();
        }
Ejemplo n.º 6
0
        private void FirmarFacturaToolStripMenuItemClick(object sender, EventArgs e)
        {
            using (OpenFileDialog openCertificadoFileDialog = new OpenFileDialog
            {
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                Title = FacturasRecursos.Form1_firmarFacturaToolStripMenuItem_Click_Seleccione_su_certificado_de_usuario,
                Filter = FacturasRecursos.Form1_firmarFacturaToolStripMenuItem_Click_Certificado_Digital____p12____p12
            })
            {
                if (openCertificadoFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    if (!string.IsNullOrEmpty(openCertificadoFileDialog.FileName))
                    {
                        Passs pass = new Passs();

                        if (pass.ShowDialog() == DialogResult.OK)
                        {
                            Cert myCert = null;
                            try
                            {
                                myCert = new Cert(openCertificadoFileDialog.FileName, pass.Password);
                            }
                            catch (Exception ex)
                            {
                                XtraMessageBox.Show(ex.Message, Application.ProductName);
                                return;
                            }

                            OpenFileDialog openFileDialog = new OpenFileDialog
                            {
                                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                Title            =
                                    FacturasRecursos.
                                    Form1_firmarFacturaToolStripMenuItem_Click_Seleccione_una_factura_sin_firmar,
                                Filter =
                                    FacturasRecursos.
                                    Form1_firmarFacturaToolStripMenuItem_Click_Factura____pdf____pdf
                            };


                            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
                            {
                                if (!string.IsNullOrEmpty(openFileDialog.FileName))
                                {
                                    MetaData myMd = new MetaData();
                                    myMd.Author   = Settings.Default.nombre;
                                    myMd.Title    = string.Format("Factura emitida por {0}", Settings.Default.nombre);
                                    myMd.Subject  = "Factura por translado en taxi";
                                    myMd.Keywords = "factura, taxi, mariano";
                                    myMd.Creator  = "Riccardo Prieto Mendoza";
                                    myMd.Producer = "Riccardo Prieto Mendoza";

                                    using (SaveFileDialog sabeD = new SaveFileDialog
                                    {
                                        InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                        Title = FacturasRecursos.Form1_firmarFacturaToolStripMenuItem_Click_Guardar_Factura_Firmada_como___,
                                        Filter = FacturasRecursos.Form1_firmarFacturaToolStripMenuItem_Click_Factura____pdf____pdf
                                    })
                                    {
                                        if (sabeD.ShowDialog(this) == DialogResult.OK)
                                        {
                                            PdfSigner pdfs = new PdfSigner(openFileDialog.FileName, sabeD.FileName, myCert, myMd);
                                            pdfs.Sign("Factura por translado en taxi", Settings.Default.email, Settings.Default.direccion + " " + Settings.Default.poblacionCP, false);


                                            Process.Start(sabeD.FileName);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private bool Check_Valid()
        {
            bool    functionReturnValue = false;
            Control CtrlErr             = null;

            if ((DxErrorProvider != null))
            {
                DxErrorProvider.Dispose();
            }
            //Thông tin không được rỗng
            if (txtMaDoiTuongTroCap.Text == string.Empty)
            {
                DxErrorProvider.SetError(txtMaDoiTuongTroCap, "Mã đối tượng trợ cấp không thể rỗng.");
                if (CtrlErr == null)
                {
                    CtrlErr = txtMaDoiTuongTroCap;
                }
            }
            if (txtTenDoiTuongTroCap.Text == string.Empty)
            {
                DxErrorProvider.SetError(txtTenDoiTuongTroCap, "Tên đối tượng trợ cấp không thể rỗng.");
                if (CtrlErr == null)
                {
                    CtrlErr = txtTenDoiTuongTroCap;
                }
            }
            if (txtSoTienTroCap.Text == string.Empty)
            {
                DxErrorProvider.SetError(txtSoTienTroCap, "Số tiền trợ cấp không thể rỗng.");
                if (CtrlErr == null)
                {
                    CtrlErr = txtSoTienTroCap;
                }
            }
            if (status == 1 && txtMaDoiTuongTroCap.Text == Ma)
            {
                return(status == 1);
            }
            else
            {
                //kiểm tra mã nhập vào có trùng với dữ liệu trước không.
                if (LstDTTC != null)
                {
                    for (int i = 0; i < LstDTTC.Count; i++)
                    {
                        if (txtMaDoiTuongTroCap.Text == LstDTTC[i].MaDoiTuongTroCap)
                        {
                            DxErrorProvider.SetError(txtMaDoiTuongTroCap, "Mã đối tượng trợ cấp bị trùng.");
                            if (CtrlErr == null)
                            {
                                CtrlErr = txtMaDoiTuongTroCap;
                            }
                            txtMaDoiTuongTroCap.Text = "";
                            XtraMessageBox.Show("Mã bạn nhập đã bị trùng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            break;
                        }
                    }
                }
            }
            //Kiểm tra thông tin thành công
            if ((CtrlErr != null))
            {
                goto QUIT;
            }
            functionReturnValue = true;
            return(functionReturnValue);

QUIT:
            functionReturnValue = false;
            CtrlErr.Focus();
            return(functionReturnValue);
        }
Ejemplo n.º 8
0
        private void sb_ok_Click(object sender, EventArgs e)
        {
            if (!gridView1.PostEditor())
            {
                return;
            }
            if (!gridView1.UpdateCurrentRow())
            {
                return;
            }
            if (!gridView4.PostEditor())
            {
                return;
            }
            if (!gridView4.UpdateCurrentRow())
            {
                return;
            }

            int[] service_sel = gridView1.GetSelectedRows();
            int[] gl_sel      = gridView2.GetSelectedRows();
            int[] zl_sel      = gridView3.GetSelectedRows();
            int[] jp_sel      = gridView4.GetSelectedRows();

            if (service_sel.Length + gl_sel.Length + zl_sel.Length + jp_sel.Length <= 0)
            {
                XtraMessageBox.Show("请先选择项目!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            //延申服务处理
            foreach (int i in service_sel)
            {
                if (ElementExisted(gridView1.GetRowCellValue(i, "ITEM_ID").ToString()))
                {
                    if (XtraMessageBox.Show("【" + gridView1.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SA01 sa01 = new SA01(collection.Session);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.SA002  = "05";                 //殡仪服务
                sa01.SA003  = gridView1.GetRowCellValue(i, "ITEM_TEXT").ToString();
                sa01.SA004  = gridView1.GetRowCellValue(i, "ITEM_ID").ToString();
                sa01.SA005  = "1";                  //销售类型 - 临时性销售
                sa01.PRICE  = Convert.ToDecimal(gridView1.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = Convert.ToInt32(gridView1.GetRowCellValue(i, "NUMS"));
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                collection.Add(sa01);
            }

            //谷类处理
            foreach (int i in gl_sel)
            {
                if (ElementExisted(gridView2.GetRowCellValue(i, "ITEM_ID").ToString()))
                {
                    if (XtraMessageBox.Show("【" + gridView2.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SA01 sa01 = new SA01(collection.Session);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.SA002  = "10";                 //谷类
                sa01.SA003  = gridView2.GetRowCellValue(i, "ITEM_TEXT").ToString();
                sa01.SA004  = gridView2.GetRowCellValue(i, "ITEM_ID").ToString();
                sa01.SA005  = "1";                  //销售类型 - 临时性销售
                sa01.PRICE  = Convert.ToDecimal(gridView2.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = Convert.ToInt32(gridView2.GetRowCellValue(i, "NUMS"));
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                collection.Add(sa01);
            }

            //纸类处理
            foreach (int i in zl_sel)
            {
                if (ElementExisted(gridView3.GetRowCellValue(i, "ITEM_ID").ToString()))
                {
                    if (XtraMessageBox.Show("【" + gridView3.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SA01 sa01 = new SA01(collection.Session);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.SA002  = "11";                 //纸类
                sa01.SA003  = gridView3.GetRowCellValue(i, "ITEM_TEXT").ToString();
                sa01.SA004  = gridView3.GetRowCellValue(i, "ITEM_ID").ToString();
                sa01.SA005  = "1";
                sa01.PRICE  = Convert.ToDecimal(gridView3.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = Convert.ToInt32(gridView3.GetRowCellValue(i, "NUMS"));
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                collection.Add(sa01);
            }
            //祭品处理
            foreach (int i in jp_sel)
            {
                if (ElementExisted(gridView4.GetRowCellValue(i, "ITEM_ID").ToString()))
                {
                    if (XtraMessageBox.Show("【" + gridView4.GetRowCellValue(i, "ITEM_TEXT").ToString() + "】已经存在,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                    {
                        return;
                    }
                }
                SA01 sa01 = new SA01(collection.Session);
                sa01.SA001  = MiscAction.GetEntityPK("SA01");
                sa01.SA002  = gridView4.GetRowCellValue(i, "ITEM_TYPE").ToString();
                sa01.SA003  = gridView4.GetRowCellValue(i, "ITEM_TEXT").ToString();
                sa01.SA004  = gridView4.GetRowCellValue(i, "ITEM_ID").ToString();
                sa01.SA005  = "1";
                sa01.PRICE  = Convert.ToDecimal(gridView4.GetRowCellValue(i, "PRICE"));
                sa01.NUMS   = Convert.ToInt32(gridView4.GetRowCellValue(i, "NUMS"));
                sa01.SA007  = sa01.PRICE * sa01.NUMS;
                sa01.SA006  = sa01.PRICE;
                sa01.SA008  = "0";
                sa01.SA100  = Envior.cur_user.UC001;
                sa01.SA200  = MiscAction.GetServerTime();
                sa01.STATUS = "1";
                collection.Add(sa01);
            }

            this.Close();
        }
Ejemplo n.º 9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!valName.Validate())
            {
                txtName.Focus();
                return;
            }
            if (!valBirth.Validate())
            {
                dtBirthdate.Focus();
                return;
            }
            if (!valGender.Validate())
            {
                cmbGender.Focus();
                return;
            }
            if (!valPhone.Validate())
            {
                txtPhone.Focus();
                return;
            }
            if (!valOffer.Validate())
            {
                cmbOffers.Focus();
                return;
            }

            MemoryStream ms = new MemoryStream();

            pBox.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            byte[]   img      = ms.ToArray();
            DateTime dt       = Convert.ToDateTime(dtBirthdate.EditValue);
            int      SocialID = Convert.ToInt32(radioGroup1.EditValue);

            if (txtCardNumber.Text != "")
            {
                a.addTrainee(txtCardNumber, txtName, dt, cmbGender, cmbStatus, txtNationality, txtDegree, txtNationalID, txtNotes, dtHiring, txtTel, txtPhone, txtAddress, txtMail,
                             img, radioGroup1, ref TraineeID);
                a.addTraineeProfile(TraineeID, cmbOffers, dtBegin, dtEnd, txtPrice, txtPaid, txtCarry, sessionNum, freezing, invitations, spa, massage, others, inbody,
                                    RGpaymentMethod, type, ref LogID, cmbTrainers, cmbEmployee);
                a.incrementSocialMedia(SocialID);
                if (Convert.ToDouble(txtPaid.Text) == 0)
                {
                    a.addCash(1, "إضافة إشتراك", 0.ToString(), txtPaid.Text, "", txtName.Text, cmbOffers.Text);
                }
                if (Convert.ToDouble(txtPaid.Text) > 0)
                {
                    a.addCash(1, "إضافة إشتراك", Properties.Settings.Default.RecieptID.ToString(), txtPaid.Text, RGpaymentMethod.Text, txtName.Text, cmbOffers.Text);
                    if (RGpaymentMethod.SelectedIndex == 0)
                    {
                        u.updateTraffic(Convert.ToDouble(txtPaid.Text), 0);
                    }
                    f.fillRpt(txtName.Text, txtPaid, offerName, Convert.ToDateTime(dtBegin.EditValue), Convert.ToDateTime(dtEnd.EditValue), txtCarry.Text, RGpaymentMethod.SelectedIndex);
                    Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                    Properties.Settings.Default.Save();
                }
                XtraMessageBox.Show("تمت الإضافة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (XtraMessageBox.Show("هل تريد إضافة inbody report?", "سؤال", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (inbody == 0)
                    {
                        XtraMessageBox.Show("هذا الإشتراك ليس له تقارير", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    frmInbodyReport frm = new frmInbodyReport();
                    frm.LogID = LogID;
                    frm.ShowDialog();
                }
                this.Close();
            }
            else if (txtCardNumber.Text == "")
            {
                if (XtraMessageBox.Show("لم يتم تمرير الكارت، هل تريد الإستمرار؟", "تنبيه", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    a.addTrainee(txtCardNumber, txtName, dt, cmbGender, cmbStatus, txtNationality, txtDegree, txtNationalID, txtNotes, dtHiring, txtTel, txtPhone, txtAddress, txtMail,
                                 img, radioGroup1, ref TraineeID);
                    a.addTraineeProfile(TraineeID, cmbOffers, dtBegin, dtEnd, txtPrice, txtPaid, txtCarry, sessionNum, freezing, invitations, spa, massage, others, inbody,
                                        RGpaymentMethod, type, ref LogID, cmbTrainers, cmbEmployee);
                    a.incrementSocialMedia(SocialID);
                    if (Convert.ToDouble(txtPaid.Text) == 0)
                    {
                        a.addCash(1, "إضافة إشتراك", 0.ToString(), txtPaid.Text, "", txtName.Text, cmbOffers.Text);
                    }
                    if (Convert.ToDouble(txtPaid.Text) > 0)
                    {
                        a.addCash(1, "إضافة إشتراك", Properties.Settings.Default.RecieptID.ToString(), txtPaid.Text, RGpaymentMethod.Text, txtName.Text, cmbOffers.Text);
                        if (RGpaymentMethod.SelectedIndex == 0)
                        {
                            u.updateTraffic(Convert.ToDouble(txtPaid.Text), 0);
                        }
                        f.fillRpt(txtName.Text, txtPaid, offerName, Convert.ToDateTime(dtBegin.EditValue), Convert.ToDateTime(dtEnd.EditValue), txtCarry.Text, RGpaymentMethod.SelectedIndex);
                        Properties.Settings.Default.RecieptID = ++Properties.Settings.Default.RecieptID;
                        Properties.Settings.Default.Save();
                    }
                    XtraMessageBox.Show("تمت الإضافة بنجاح", "إضافة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (XtraMessageBox.Show("هل تريد إضافة inbody report?", "سؤال", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (inbody == 0)
                        {
                            XtraMessageBox.Show("هذا الإشتراك ليس له تقارير", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            this.Close();
                            return;
                        }
                        else
                        {
                            frmInbodyReport frm = new frmInbodyReport();
                            frm.LogID = LogID;
                            frm.ShowDialog();
                        }
                    }
                    this.Close();
                }
            }
        }
Ejemplo n.º 10
0
        private void MenuandSubmenu_Click(object sender, EventArgs e)
        {
            #region Click Event for Menu & SubMenu

            NavBarItem _NavBarItem = (NavBarItem)sender;
            string     NameText    = _NavBarItem.Name.ToString().Trim();
            if (NameText == "mnuCompanyInfo")
            {
                form_load("frmCompanyInfo");
            }
            else if (NameText == "mnuTerminalInfo")
            {
                form_load("frmTerminalInfo");
            }
            else if (NameText == "mnuBalanceSheet")
            {
                form_load("frmBalanceSheet");
            }
            else if (NameText == "mnuUserInfo")
            {
                //frmUserInfo obj = new frmUserInfo();
                //obj.ShowDialog();
                form_load("frmUserInfo");
            }

            else if (NameText == "mnuExit")
            {
                //this.Close();
                Application.Exit();
            }

            else if (NameText == "mnuUnitInfo")
            {
                //frmUnitInfo obj = new frmUnitInfo();
                //obj.ShowDialog();
                form_load("frmUnitInfo");
            }

            else if (NameText == "mnuSectionInfo")
            {
                //frmSectionInfo obj = new frmSectionInfo();
                //obj.ShowDialog();
                form_load("frmSectionInfo");
            }

            else if (NameText == "mnuBranchInfo")
            {
                //frmBranchInfo obj = new frmBranchInfo();
                //obj.ShowDialog();
                form_load("frmBranchInfo");
            }

            else if (NameText == "mnuAccountTypeInfo")
            {
                //frmAccountHolderType obj = new frmAccountHolderType();
                //obj.ShowDialog();
                form_load("frmAccountHolderType");
            }

            else if (NameText == "mnuAccountHolderInfo")
            {
                //frmAccountHolderInfo obj = new frmAccountHolderInfo();
                //obj.ShowDialog();
                form_load("frmAccountHolderInfo");
            }

            else if (NameText == "mnuSubSection")
            {
                //frmSubSectionInfo obj = new frmSubSectionInfo();
                //obj.ShowDialog();
                form_load("frmSubSectionInfo");
            }

            else if (NameText == "mnuDBBackup")
            {
                DialogResult result;
                result = XtraMessageBox.Show("RUN DATABASE BACKUP PROCESS...?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    if (bllUtility.CreateDB_Backup() == true)
                    {
                        XtraMessageBox.Show("Database Backup Successfully.");
                    }
                }
            }
            else if (NameText == "mnuDelPurchase")
            {
                //frmDeletePurchase obj = new frmDeletePurchase();
                //obj.ShowDialog();
                form_load("frmDeletePurchase");
            }
            else if (NameText == "mnuVatInfo")
            {
                //frmVatInfo obj = new frmVatInfo();
                //obj.ShowDialog();
                form_load("frmVatInfo");
            }

            else if (NameText == "mnuManufacturerInfo")
            {
                //frmManufacturerInfo obj = new frmManufacturerInfo();
                //obj.ShowDialog();
                form_load("frmManufacturerInfo");
            }

            else if (NameText == "mnuStoreInfo")
            {
                //frmStoreInfo obj = new frmStoreInfo();
                //obj.ShowDialog();
                form_load("frmStoreInfo");
            }

            else if (NameText == "mnuPayType")
            {
                //frmPayType obj = new frmPayType();
                //obj.ShowDialog();
                form_load("frmPayType");
            }

            else if (NameText == "mnuSalesInfo")
            {
                //frmSalesInfo obj = new frmSalesInfo();
                //obj.ShowDialog();
                form_load("frmSalesInfo");
            }

            else if (NameText == "mnuPurchase")
            {
                //frmPurchaseInfo obj = new frmPurchaseInfo();
                //obj.ShowDialog();
                form_load("frmPurchaseInfo");
            }

            else if (NameText == "mnuSalesReturn")
            {
                //frmSalesReturnInfo obj = new frmSalesReturnInfo();
                //obj.ShowDialog();
                form_load("frmReturnNew");
            }

            else if (NameText == "mnuPurchaseReturn")
            {
                //frmPurchaseReturn obj = new frmPurchaseReturn();
                //obj.ShowDialog();
                form_load("frmPurchaseReturn");
            }

            else if (NameText == "mnuStocktransfer")
            {
                //frmStockTransferInfo obj = new frmStockTransferInfo();
                //obj.ShowDialog();
                form_load("frmStockTransferInfo");
            }

            else if (NameText == "mnuDefaultSetup")
            {
                //frmDefautSetup obj = new frmDefautSetup();
                //obj.ShowDialog();
                form_load("frmDefautSetup");
            }

            else if (NameText == "mnuProductInfo")
            {
                //frmProductInfo obj = new frmProductInfo();
                //obj.ShowDialog();
                form_load("frmProductInfo");
            }

            else if (NameText == "mnuUserMenuConfigure")
            {
                //frmUserMenu _OfrmUserMenu = new frmUserMenu();
                //_OfrmUserMenu.ShowDialog();
                form_load("frmUserMenu");
            }

            else if (NameText == "mnuMasterMenuList")
            {
                //frmMenuSetup _OfrmMenuSetup = new frmMenuSetup();
                //_OfrmMenuSetup.ShowDialog();
                form_load("frmMenuSetup");
            }
            else if (NameText == "mnuPasswordChange")
            {
                form_load("frmChangePassWord");
            }
            else if (NameText == "mnuPasswordChange")
            {
                form_load("frmChangePassWord");
            }
            else if (NameText == "mnuTransactionType")
            {
                form_load("frmAccountTransaction");
            }
            else if (NameText == "mnuTransactionType_new")
            {
                form_load("frmAccountTransactions");
            }
            else if (NameText == "mnuDelSalesInvoice")
            {
                form_load("frmDelSalesInvoice");
            }
            else if (NameText == "mnuSalesRefund")
            {
                form_load("frmSalesRefundInfo");
            }
            else if (NameText == "mnuSalesRefundInvoice")
            {
                form_load("frmListOfSalesRefundInvoice");
            }
            else if (NameText == "mnuSalesReturnInvoice")
            {
                form_load("frmListOfSalesReturnInvoice");
            }
            else if (NameText == "mnuSalesInvoice")
            {
                form_load("frmListOfSalesInvoice");
            }
            else if (NameText == "mnuPurchaseInvoice")
            {
                form_load("frmListOfPurchaseInvoice");
            }
            //else if (NameText == "mnuExit")
            //{
            //    Application.Exit();
            //}
            ///////////////////////  report menu start ////////////////////////////////////
            else if (NameText == "mnuProductSalesStatement")
            {
                form_load("frmReportSalesStatement");
            }
            else if (NameText == "mnuProductSalesProfit")
            {
                form_load("frmReportProductSalesProfit");
            }
            else if (NameText == "mnuProductPurchaseStatement")
            {
                form_load("frmReportPurchaseStatement");
            }
            else if (NameText == "mnuRptProductList")
            {
                form_load("frmReportProductList");
            }
            else if (NameText == "mnuMonthlyAccountStatement")
            {
                form_load("frmReportMonthlyAccStatement");
            }
            else if (NameText == "mnuPersonalStatement")
            {
                form_load("frmReportPersonalStatement");
            }
            else if (NameText == "mnuRptReorderProduct")
            {
                form_load("frmReportReOrderProduct");
            }
            else if (NameText == "mnuExpenditure")
            {
                form_load("frmReportExpenditure");
            }
            else if (NameText == "mnuDebitorCreditor")
            {
                form_load("frmReportDebtoCredtorList");
            }
            else if (NameText == "mnuProductOpenCloseStock")
            {
                form_load("frmReportOpeningClosingStock");
            }
            else if (NameText == "mnuCashBook")
            {
                form_load("frmReportCashBook");
            }
            else if (NameText == "mnuRptCurrentProductStock")
            {
                form_load("frmReportCurrentStock");
            }
            else if (NameText == "mnuCashReceive")
            {
                form_load("frmReportCashReceive");
            }
            else if (NameText == "mnuSalesReturnStatement")
            {
                form_load("frmReportSalesReturn");
            }
            else if (NameText == "mnuProductOut")
            {
                form_load("frmProductOut");
            }
            else if (NameText == "mnuCommission")
            {
                form_load("frmCommissionCalculation");
            }
            else if (NameText == "mnuZoneSetup")
            {
                form_load("frmZone");
            }
            else if (NameText == "mnuIncomeStatement")
            {
                form_load("frmRptIncomeStatement");
            }
            else if (NameText == "mnuDataSynchronization")
            {
                form_load("frmDataSynchronization");
            }
            else if (NameText == "mnuMaterialSetup")
            {
                form_load("frmMaterialInfo");
            }
            else if (NameText == "mnuMaterialPurchaseInfo")
            {
                form_load("frmMaterialPurchaseInfo");
            }
            else if (NameText == "mnuProduction")
            {
                form_load("frmProduction");
            }
            else if (NameText == "mnuReportMaterialTransaction")
            {
                form_load("frmReportMaterialTransaction");
            }
            //////////////////////////// End of report menu ////////////////////////////////
            #endregion
        }
Ejemplo n.º 11
0
        private void btn_file_upload_Click(object sender, EventArgs e)
        {
            string ftp_url      = "ftp://nannabiriyanimirpur10.com/";
            string ftp_user     = "******";
            string ftp_pass     = "******";
            string default_path = "E:\\csv\\";
            string file1        = default_path + "account_holder_info.csv";
            string file2        = default_path + "account_holder_type.csv";
            string file3        = default_path + "account_transaction_details_info.csv";
            string file4        = default_path + "daily_sales_section_wise.csv";
            string file5        = default_path + "dealer_rsm_configure.csv";
            string file6        = default_path + "dealer_wise_avg_product_rate.csv";
            string file7        = default_path + "section_info.csv";

            try
            {
                Cursor = Cursors.WaitCursor;
                if (File.Exists(file1))
                {
                    UploadFile(ftp_url, file1, ftp_user, ftp_pass, "");
                }
                Cursor = Cursors.Default;

                Cursor = Cursors.WaitCursor;
                if (File.Exists(file2))
                {
                    UploadFile(ftp_url, file2, ftp_user, ftp_pass, "");
                }
                Cursor = Cursors.Default;

                Cursor = Cursors.WaitCursor;
                if (File.Exists(file3))
                {
                    UploadFile(ftp_url, file3, ftp_user, ftp_pass, "");
                }
                Cursor = Cursors.Default;

                Cursor = Cursors.WaitCursor;
                if (File.Exists(file4))
                {
                    UploadFile(ftp_url, file4, ftp_user, ftp_pass, "");
                }
                Cursor = Cursors.Default;

                Cursor = Cursors.WaitCursor;
                if (File.Exists(file5))
                {
                    UploadFile(ftp_url, file5, ftp_user, ftp_pass, "");
                }
                Cursor = Cursors.Default;

                Cursor = Cursors.WaitCursor;
                if (File.Exists(file6))
                {
                    UploadFile(ftp_url, file6, ftp_user, ftp_pass, "");
                }
                Cursor = Cursors.Default;

                Cursor = Cursors.WaitCursor;
                if (File.Exists(file7))
                {
                    UploadFile(ftp_url, file7, ftp_user, ftp_pass, "");
                }
                Cursor = Cursors.Default;

                lbl2.Text = "Successfully Done";
                btn_file_upload.Enabled = false;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.ToString());
            }
        }
 public static DialogResult Error(Exception ex)
 {
     return(XtraMessageBox.Show(ex.Message,
                                "Quản lý đạo tạo AGU", MessageBoxButtons.OK, MessageBoxIcon.Error));
 }
 public static DialogResult YesNoCancel(string message)
 {
     return(XtraMessageBox.Show(message, "Quản lý đạo tạo AGU",
                                MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3));
 }
 public static DialogResult Exclamation(string message)
 {
     return(XtraMessageBox.Show(message, "Quản lý đạo tạo AGU",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation));
 }
        //NEW EVENT
        void OnTabHeaderDoubleClick(object sender, TabHeaderDoubleClickEventArgs e)
        {
            XtraMessageBox.Show(e.TabPage.Text);

        }
Ejemplo n.º 16
0
        private void TestBtn_Click(object sender, EventArgs e)
        {
            var btn = (SimpleButton)sender;

            try
            {
                if (doWorkRun)
                {
                    if (XtraMessageBox.Show("Вы действительно хотите простановить гравировку?", "Сообщения", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        doWorkRun = false;
                    }
                    else
                    {
                        return;
                    }
                }

                if (btn.Text == "TEST")
                {
                    doWorkTest = true;
                    if (btn.Tag.ToString() == "redMark")
                    {
                        if (!testRedMarkBackgroundWorker.IsBusy)
                        {
                            testRedMarkBackgroundWorker.RunWorkerAsync();
                        }

                        btn.Tag = "redMarkContour";
                    }
                    else if (btn.Tag.ToString() == "redMarkContour")
                    {
                        if (!testRedMarkContourBackgroundWorker.IsBusy)
                        {
                            testRedMarkContourBackgroundWorker.RunWorkerAsync();
                        }

                        btn.Tag = "redMark";
                    }

                    btn.BackColor = btn.BackColor = Color.FromArgb(192, 0, 0);
                    btn.Text      = "STOP TEST";
                }
                else if (btn.Text == "STOP TEST")
                {
                    doWorkTest = false;
                    if (btn.Tag.ToString() == "redMark")
                    {
                        testRedMarkBackgroundWorker.WorkerSupportsCancellation = true;

                        btn.Tag = "redMarkContour";
                    }
                    else if (btn.Tag.ToString() == "redMarkContour")
                    {
                        testRedMarkContourBackgroundWorker.WorkerSupportsCancellation = true;

                        btn.Tag = "redMark";
                    }
                    btn.BackColor = Color.FromArgb(0, 192, 192);
                    btn.Text      = "TEST";
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.Message, "Information", MessageBoxButtons.OK);
            }
        }
Ejemplo n.º 17
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            errorProvider.Clear();

            if (string.IsNullOrEmpty(monhoc) || string.IsNullOrEmpty(lop))
            {
                this.btnNhap.Enabled = true;
                this.btnLuu.Enabled = false;

                errorProvider.SetError(this.btnNhap, "Các trường thông tin nhập điểm không được để trống !");
                return;
            }


            if (checkEmptyRow())
            {
                this.btnNhap.Enabled = false;
                this.btnLuu.Enabled = true;
                errorProvider.SetError(this.btnLuu, "Bạn chưa nhập hết bản điểm cho sinh viên !");
                return;
            }
            else
            {
                //get binding source từ gridcontrol
                BindingSource bdsTemp = (BindingSource)this.gridControlDiem.DataSource;
             
                // kết thúc việc cập nhật dữ liệu
                this.Validate();
                bdsTemp.EndEdit();


                // bắt đầu ghi dữ liệu
                SqlConnection conn = new SqlConnection(Program.URL_Connect);
                // bắt đầu transaction
                SqlTransaction tran;

                conn.Open();
                tran = conn.BeginTransaction();

                try
                {

                   
                    for (int i = 0; i < bdsTemp.Count ; i++)
                    {

                        SqlCommand cmd = new SqlCommand("SP_INSERT_DIEM", conn);
                        cmd.Connection = conn;
                        cmd.Transaction = tran;



                        cmd.CommandType = CommandType.StoredProcedure;
                        string masv = ((DataRowView)bdsTemp[i])["MASV"].ToString();
                        cmd.Parameters.Add(new SqlParameter("@MASV", masv));
                        cmd.Parameters.Add(new SqlParameter("@MAMH", monhoc));
                        cmd.Parameters.Add(new SqlParameter("@LAN", lanthi));

                        float diem = float.Parse(((DataRowView)bdsTemp[i])["DIEM"].ToString());
                        cmd.Parameters.Add(new SqlParameter("@DIEM", diem));

                         cmd.ExecuteNonQuery();
                  

                    }


                    tran.Commit();
                }
                catch (SqlException sqlex)
                {
                    try
                    {

                        tran.Rollback();
                        XtraMessageBox.Show("Lỗi ghi toàn bộ điểm vào Database. Bạn hãy xem lại ! " + sqlex.Message, "", MessageBoxButtons.OK);

                    }
                    catch (Exception ex2)
                    {
                        Console.WriteLine("Rollback Exception Type: {0}", ex2.GetType());
                        Console.WriteLine("  Message: {0}", ex2.Message);
                    }
                    conn.Close();
                    return;
                }
                finally
                {
                    conn.Close();
                }


             

                XtraMessageBox.Show("Thao tác thành công!", "", MessageBoxButtons.OK);
                this.btnNhap.Enabled = true;
                this.btnLuu.Enabled = false;
                this.groupControlNhapDiem.Enabled = true;
                return;
            }
        }
Ejemplo n.º 18
0
        private void btnAddList_OS_Click(object sender, EventArgs e)
        {
            if (TempPosteriorSegmentSignListToBeAdded_OS == null || TempPosteriorSegmentSignListToBeAdded_OS.Count == 0)
            {
                XtraMessageBox.Show(
                    "You should select at least one Posterior Segment Sign to be added." + "\r\n" +
                    "You can select one or more Posterior Segment Sign to add", "Note", MessageBoxButtons.OK,
                    MessageBoxIcon.Hand);
                return;
            }

            if (AddedPosteriorSegmentSign_OS == null)
            {
                AddedPosteriorSegmentSign_OS = new List <SegmentSign_cu>();
            }
            if (TempPosteriorSegmentSignListToBeAdded_OS != null && TempPosteriorSegmentSignListToBeAdded_OS.Count > 0)
            {
                foreach (SegmentSign_cu segmentSign in TempPosteriorSegmentSignListToBeAdded_OS)
                {
                    if (!AddedPosteriorSegmentSign_OS.Exists(item =>
                                                             Convert.ToInt32(item.ID).Equals(Convert.ToInt32(segmentSign.ID))))
                    {
                        AddedPosteriorSegmentSign_OS.Add(segmentSign);
                        if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign == null)
                        {
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign =
                                new List <VisitTiming_MainPosteriorSegmentSign>();
                            _mainPosteriorSegmentSign = PEMRBusinessLogic.CreateNew_VisitTiming_MainPosteriorSegmentSign(
                                FurtherDetails_OD, FurtherDetails_OS,
                                ApplicationStaticConfiguration.PEMRSavingMode);
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign.Add(
                                _mainPosteriorSegmentSign);
                        }

                        if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign[0] != null)
                        {
                            if (!string.IsNullOrEmpty(txtReccommednations_OD.Text) ||
                                !string.IsNullOrWhiteSpace(txtReccommednations_OD.Text))
                            {
                                PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign[0].GeneralDescription_OD
                                    = txtReccommednations_OD.Text;
                            }
                            else
                            {
                                PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign[0]
                                .GeneralDescription_OD = null;
                            }
                        }

                        if (PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign == null)
                        {
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign =
                                new List <VisitTiming_PosteriorSegmentSign>();
                        }
                        _visitTimingPosteriorSegment = PEMRBusinessLogic.CreateNew_VisitTiming_PosteriorSegmentSign(
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_MainPosteriorSegmentSign[0], segmentSign,
                            DB_EyeType_p.OS, DB_PEMRSavingMode.SaveImmediately);
                        if (_visitTimingPosteriorSegment != null)
                        {
                            PEMRBusinessLogic.ActivePEMRObject.List_VisitTiming_PosteriorSegmentSign.Add(
                                _visitTimingPosteriorSegment);
                        }
                    }
                }
            }

            TempPosteriorSegmentSignListToBeAdded_OS = null;
            CommonViewsActions.FillListBoxControl(lstAddedPosteriorSegment_OS, AddedPosteriorSegmentSign_OS);
            lstAddedPosteriorSegment_OS.Refresh();
            SetCount_OS();
            SetCount_OS();
            lstPosteriorSegment_OS.SelectedIndex = -1;
        }
Ejemplo n.º 19
0
        private void GenerarFicheroFacturaPdfToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (!DatosLineaValido())
            {
                return;
            }
            bsFactura.EndEdit();
            Factura factura = bsFactura.Current as Factura;

            ActualizarContadoresLineas();

            try
            {
                XtraReportFactura xtraReport = new XtraReportFactura
                {
                    Factura = factura
                };

                xtraReport.Parameters["licenciaMunicipal"].Value = Settings.Default.licencia;
                xtraReport.Parameters["email"].Value             = Settings.Default.email;
                xtraReport.Parameters["Movil"].Value             = Settings.Default.movil;
                xtraReport.Parameters["Nif"].Value       = Settings.Default.nif;
                xtraReport.Parameters["Telefono"].Value  = Settings.Default.telefono;
                xtraReport.Parameters["nombre"].Value    = Settings.Default.nombre;
                xtraReport.Parameters["direccion"].Value = Settings.Default.direccion;
                xtraReport.Parameters["poblacion"].Value = Settings.Default.poblacionCP;

                if (!string.IsNullOrEmpty(Settings.Default.Iban))
                {
                    xtraReport.Parameters["poblacion"].Value = string.Format("IBAN: {0}", Settings.Default.Iban);
                }
                else
                {
                    xtraReport.Parameters["poblacion"].Value = string.Format("IBAN: {0}", Settings.Default.ccc);
                }

                SetTextWatermark(xtraReport);

                using (ReportPrintTool printTool = new ReportPrintTool(xtraReport))
                {
                    // Invoke the Ribbon Print Preview form modally,
                    // and load the report document into it.
                    printTool.ShowRibbonPreviewDialog();

                    // Invoke the Ribbon Print Preview form
                    // with the specified look and feel setting.
                    printTool.ShowRibbonPreview(UserLookAndFeel.Default);
                }
                //(new PdfGenerador(factura)).Run();
            }
            catch (Exception exception)
            {
                XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }

            if (factura != null)
            {
                Settings.Default.ultimaFactura = factura.Numero;
            }
            Settings.Default.Save();
        }
Ejemplo n.º 20
0
        private void gridViewData_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            try
            {
                using (clsConnection oConn = new clsConnection())
                {
                    string categoryId = Convert.ToString(gridViewData.GetFocusedRowCellValue(colCarCategoryId));
                    string strCount   = clsGlobal.getData1Field("select count(*) from tbm_carcategory where dlt='0' and trim(lower(carcategoryname))=trim(lower('" + Convert.ToString(gridViewData.GetFocusedRowCellValue(colCategoryName)) + "')) and carcategoryid <>'" + categoryId + "'");
                    if (Convert.ToInt32(strCount) == 0)
                    {
                        tbm_carcategory oObject = new tbm_carcategory();
                        oConn.Open();
                        oObject.Koneksi = oConn.Conn;
                        if (!string.IsNullOrEmpty(categoryId))
                        {
                            oObject.GetByPrimaryKey(categoryId);
                        }
                        oObject.categoryid   = Convert.ToString(gridViewData.GetFocusedRowCellValue(colCarCategoryId));
                        oObject.categoryname = Convert.ToString(gridViewData.GetFocusedRowCellValue(colCategoryName));

                        if (oObject.categoryname == "")
                        {
                            XtraMessageBox.Show("Data Can't Be Null", "Warning");
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(categoryId))
                            {
                                oObject.categoryid = oObject.NewID();
                                oObject.opadd      = clsGlobal.strUserName;
                                oObject.pcadd      = SystemInformation.ComputerName;
                                oObject.luadd      = DateTime.Now;
                                oObject.Insert();
                                gridViewData.SetFocusedRowCellValue(colCarCategoryId, oObject.categoryid);
                            }
                            else
                            {
                                oObject.opedit = clsGlobal.strUserName;
                                oObject.pcedit = SystemInformation.ComputerName;
                                oObject.luedit = DateTime.Now;
                                oObject.Update();
                            }
                            oObject = null;
                            e.Valid = true;
                        }
                    }
                    else
                    {
                        e.ErrorText = "This code " + Convert.ToString(gridViewData.GetFocusedRowCellValue(colCategoryName)) + " already exists in database and cannot be filled the same value.!\n";
                        gridViewData.FocusedColumn = colCategoryName;
                        e.Valid = false;
                        return;
                    }
                }
            }
            catch (NpgsqlException ex)
            {
                ////clsGlobal.generateErrMessageAndSendmail(ex, false);
            }
            catch (Exception ex)
            {
                ////clsGlobal.generateErrMessageAndSendmail(ex, false);
            }
        }
        private void btnProcess_Click(object sender, EventArgs e)
        {
            txtSearch.Enabled = false;
            DataCenter dc = new DataCenter();
            UserInfo   ui = new UserInfo();

            DateTime date       = DateTime.Now;
            string   permitDate = date.ToString("yyyy-MM-dd");

            if (dgvCheck2 == null || dgvCheck2.Rows.Count == 0)
            {
                XtraMessageBox.Show("ไม่มีรายการที่ต้องประมวลผล", "แจ้งทราบ", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (XtraMessageBox.Show("ตรวจสอบข้อมูลเรียบร้อยแล้ว ต้องการบันทึกใช่หรือไม่?", "แจ้งทราบ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                // update ซื้อร่วมเขตหรือไม่
                foreach (DataGridViewRow row in dgvCheck2.Rows)
                {
                    if (Convert.ToBoolean(row.Cells["CoSSK"].Value) == true)
                    {
                        string sql     = string.Format(@"UPDATE receivedata_dummy SET CoSSK = 1 WHERE dummy_id = '{0}'", row.Cells[2].Value.ToString());
                        bool   result2 = dc.Update(sql);
                        if (result2)
                        {
                            //XtraMessageBox.Show("OK CoSSK");
                        }
                    }

                    if (Convert.ToBoolean(row.Cells["CoSubSSK"].Value) == true)
                    {
                        string sql     = string.Format(@"UPDATE receivedata_dummy SET CoSubSSK = 1 WHERE dummy_id = '{0}'", row.Cells[2].Value.ToString());
                        bool   result2 = dc.Update(sql);
                        if (result2)
                        {
                            //XtraMessageBox.Show("OK CoSubSSK");
                        }
                    }
                }

                // clear dgvCheck2 เพื่อดึงข้อมูลใหม่ หลังจากอัพเดท
                //dgvCheck2.Rows.Clear();
                dgvCheck2.DataSource = null;
                FillData(txtSearch.Text.Trim());


                // insert into receivedata
                string query  = string.Format(@"INSERT INTO receivedata VALUES ('{0}','{1}','{2}','{3}','{4}','{5}')", null, ui.user_ID, lblCount.Text, lblTotalPrice.Text, '1', permitDate);
                bool   result = dc.Insert(query);
                if (result)
                {
                    // select receive_id from receivedata first then insert into  receivedatadetails in every transaction
                    string queryReceiveID = string.Format(@"SELECT MAX(receive_id) FROM receivedata LIMIT 1");
                    string receive_id     = dc.SelectData(queryReceiveID).Rows[0][0].ToString(); // แปลง Datatable เป็น string

                    foreach (DataGridViewRow data in dgvCheck2.Rows)
                    {
                        //insert into receivedatadetails
                        string query2 = string.Format(@"INSERT INTO receivedatadetails VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}')",
                                                      null,
                                                      receive_id,
                                                      data.Cells[3].Value.ToString(),
                                                      data.Cells[4].Value.ToString(),
                                                      data.Cells[5].Value.ToString(),
                                                      data.Cells[6].Value.ToString(),
                                                      data.Cells[7].Value.ToString(),
                                                      data.Cells[8].Value.ToString(),
                                                      data.Cells[9].Value.ToString(),
                                                      data.Cells[10].Value.ToString(),
                                                      data.Cells[11].Value.ToString(),
                                                      data.Cells[12].Value.ToString(),
                                                      data.Cells[13].Value.ToString(),
                                                      data.Cells[14].Value.ToString(),
                                                      data.Cells[15].Value.ToString(),
                                                      data.Cells[16].Value.ToString(),
                                                      data.Cells[17].Value.ToString(),
                                                      Convert.ToDateTime(data.Cells[18].Value.ToString()).ToString("yyyy-MM-dd"),
                                                      Convert.ToDateTime(data.Cells[19].Value.ToString()).ToString("yyyy-MM-dd"),
                                                      Convert.ToDateTime(data.Cells[20].Value.ToString()).ToString("yyyy-MM-dd"),
                                                      Convert.ToDateTime(data.Cells[21].Value.ToString()).ToString("yyyy-MM-dd"),
                                                      data.Cells[22].Value.ToString(),
                                                      data.Cells[23].Value.ToString());
                        bool result2 = dc.Insert(query2);


                        if (result2)
                        {
                            //XtraMessageBox.Show("OK na krub");
                        }
                    }
                }

                // ต้องเช็คก่อนว่า ในของแต่ละล็อต ของหมดรึยัง
                // เพราะราคาของแต่ละล็อตไม่เท่ากัน และ ต้อง FIFO
                // insert into stockcard if not exist
                foreach (DataGridViewRow row in dgvCheck2.Rows)
                {
                    // qty * pack * price
                    int     qty        = Convert.ToInt32(row.Cells[10].Value.ToString());
                    int     pack       = Convert.ToInt32(row.Cells[11].Value.ToString());
                    decimal price      = Convert.ToDecimal(row.Cells[12].Value.ToString());
                    decimal totalPrice = qty * price;

                    // totalRemain
                    int lastStock = Convert.ToInt32(row.Cells[9].Value.ToString());

                    string sql = string.Format(@"INSERT INTO stockcard VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}', '{9}', '{10}', '{11}', '{12}', '{13}', '{14}', '{15}', '{16}')",
                                               null,
                                               row.Cells[7].Value.ToString(),
                                               Convert.ToDateTime(row.Cells[18].Value.ToString()).ToString("yyyy-MM-dd"),
                                               row.Cells[4].Value.ToString(),
                                               null,
                                               lastStock,
                                               qty,
                                               pack,
                                               price,
                                               null,
                                               null,
                                               null,
                                               totalPrice / (qty * pack),
                                               totalPrice,
                                               lastStock + (qty * pack),
                                               row.Cells[15].Value.ToString(),
                                               Convert.ToDateTime(row.Cells[19].Value.ToString()).ToString("yyyy-MM-dd")
                                               );
                    bool a = dc.Insert(sql);
                    if (a)
                    {
                        //XtraMessageBox.Show("OK");
                    }
                }

                //update STOCK and PRICE to drug for liveStock
                foreach (DataGridViewRow row in dgvCheck2.Rows)
                {
                    string sql         = string.Format(@"UPDATE drug SET price = '{0}', stock = '{1}' WHERE drug_id = '{2}' ", row.Cells[12].Value.ToString(), row.Cells[14].Value.ToString(), row.Cells[7].Value.ToString());
                    bool   updateStock = dc.Update(sql);
                    if (updateStock)
                    {
                        //XtraMessageBox.Show("OK");
                    }
                }
            }
            else
            {
            }

            // clear data in dummy table
            bool delete_dummy = dc.Delete("DELETE FROM receivedata_dummy");

            if (delete_dummy)
            {
                XtraMessageBox.Show("บันทึกเรียบร้อยแล้วครับ", "แจ้งทราบ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                dgvCheck2.DataSource = null;
                txtSearch.Enabled    = true;
                lblCount.Text        = "0";
                lblTotalPrice.Text   = "0.00";
                txtSearch.Text       = "";
                txtSearch.Focus();
            }
        }
Ejemplo n.º 22
0
 public void autorizar()
 {
     XtraMessageBox.Show("NO SE PUEDE AUTORIZAR UN DOCUMENTO PENDIENTE");
 }
Ejemplo n.º 23
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!Tools.IsNumberic(edtNewCapacity.Text.Trim()))
            {
                XtraMessageBox.Show(
                    "输入的内容不是数值,请重新输入!",
                    "提示",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                edtNewCapacity.Text = edtCurrentCapacity.Text;
                edtNewCapacity.Focus();
                return;
            }

            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                int    errCode = 0;
                string errText = "";

                IRAPMDMClient.Instance.usp_SaveRSAttr_T157RX(
                    IRAPUser.Instance.CommunityID,
                    GenerateAttrChangeXML(),
                    IRAPUser.Instance.SysLogID,
                    out errCode,
                    out errText);
                WriteLog.Instance.Write(
                    string.Format("({0}){1}", errCode, errText),
                    strProcedureName);

                if (errCode == 0)
                {
                    XtraMessageBox.Show(
                        errText,
                        "提示",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    DialogResult = DialogResult.OK;
                }
                else
                {
                    XtraMessageBox.Show(
                        errText,
                        "提示",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    edtNewCapacity.Focus();
                    return;
                }
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
Ejemplo n.º 24
0
 public void firmar()
 {
     XtraMessageBox.Show("NO SE PUEDE FIRMAR UN DOCUMENTO PENDIENTE");
 }
Ejemplo n.º 25
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (bdgProductsInput.List.Count <= 0)
            {
                XtraMessageBox.Show("Informe no mínimo um produto para salvar!");
                return;
            }

            if (ckSaveInputOfSale.Checked)
            {
                if (XtraMessageBox.Show("Confirma salvar a entrada como uma compra?",
                                        "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }
            else
            {
                if (XtraMessageBox.Show("Confirma salvar a entrada sem ser uma compra?",
                                        "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    return;
                }
            }

            using (var scope = input_stock.repo.GetTransaction())
            {
                try
                {
                    input_stock ips = new input_stock()
                    {
                        cashier_id = Program.getOpenCashier().id,
                        input_at   = Program.getDateTime(),
                        users_id   = Program.userLogin.id,
                        nf         = Convert.ToInt32(tfNF.EditValue),
                        sale       = ckSaveInputOfSale.Checked
                    };
                    ips.Insert();

                    foreach (products_input pi in bdgProductsInput.List)
                    {
                        product p = product.SingleOrDefault(pi.products_id);
                        p.current_stock += pi.quantity;
                        p.Update();

                        pi.input_stock_id = ips.id;
                        pi.Save();
                    }
                    scope.Complete();
                    XtraMessageBox.Show("Entrada salva com sucesso.");
                }
                catch (Exception ex)
                {
                    input_stock.repo.AbortTransaction();
                    XtraMessageBox.Show(String.Format("Ocorreu um erro ao salvar a entrada!\n{0}\n\n{1}",
                                                      ex.Message, ex.InnerException));
                }
                finally
                {
                    this.desk.addControl(null);
                }
            }
        }
Ejemplo n.º 26
0
        private void windowsUIButton_ButtonClick(object sender, DevExpress.XtraBars.Docking2010.ButtonEventArgs e)
        {
            WindowsUIButton btn = e.Button as WindowsUIButton;
            XtraUserControl ctl = new XtraUserControl();

            switch (btn.Tag.ToString())
            {
            case "them":
            {
                Bindingdata(true);
                cothem = true;
                enableButon(false);
                break;
            }

            case "sua":
            {
                if (grvPLHD.RowCount == 0)
                {
                    return;
                }
                cothem = false;
                enableButon(false);
                break;
            }

            case "xoa":
            {
                if (grvPLHD.RowCount == 0)
                {
                    return;
                }
                DeleteData();
                break;
            }

            case "luu":
            {
                if (!dxValidationProvider1.Validate())
                {
                    return;
                }
                if (SaveData() == false)
                {
                    return;
                }
                enableButon(true);
                break;
            }

            case "khongluu":
            {
                enableButon(true);
                Bindingdata(false);
                dxValidationProvider1.Validate();
                break;
            }

            case "thoat":
            {
                if (XtraMessageBox.Show(Commons.Modules.ObjLanguages.GetLanguage(this.Name, "msgBanCoMuonThoatChuongtrinh"), Commons.Modules.ObjLanguages.GetLanguage(this.Name, "msgTieuDeThoat"), MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    return;
                }
                this.Close();
                break;
            }

            default:
                break;
            }
        }