コード例 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                txtMsg.Text = "";
                string password  = DialogConfirm.ShowInputDialog("Please provide password to continue.", "Confirm with Password");
                string finalPass = SecurityEncrypt.Decrypt(ConfigurationManager.AppSettings["CriticalSectionPassword"], "nakshal");

                if (password == finalPass)
                {
                    bool   isSuccess;
                    string msg = DBSaveManager.RationcardDelete(lblRationCardId.Text, lblCustId.Text, out isSuccess);
                    if (isSuccess)
                    {
                        txtMsg.Text = msg;
                        RefreshCatWiseCountInUi();
                        ResetForm();
                        FetchFormData();
                    }
                }
                else if (password == "")
                {
                    MessageBox.Show("Delete has been canceled by user.");
                }
                else
                {
                    MessageBox.Show("Wrong Password.");
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
コード例 #2
0
        private void btnStock_Click(object sender, EventArgs e)
        {
            string password = DialogConfirm.ShowInputDialog("Please provide password to continue.", "Confirm with Password");

            try
            {
                string finalPass = SecurityEncrypt.Decrypt(ConfigurationManager.AppSettings["CriticalSectionPassword"].ToString(), "nakshal");

                if ((User.IsSuperadmin) || (password == finalPass))
                {
                    FormHelper.OpenFrmStockSummary();
                }
                else if (password == "")
                {
                    MessageBox.Show("Stock openning is discarded by the user");
                }
                else
                {
                    MessageBox.Show("Wrong Password. Stock needs extra permission to open. Please provide correct password.");
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
コード例 #3
0
        private void btnDelPrd_Click(object sender, EventArgs e)
        {
            if (grdVwPrds.CurrentRow != null)
            {
                string password  = DialogConfirm.ShowInputDialog("Please provide password to continue.", "Confirm with Password");
                string finalPass = SecurityEncrypt.Decrypt(ConfigurationManager.AppSettings["CriticalSectionPassword"], "nakshal");

                if (password == finalPass)
                {
                    DeleteProduct();
                }
                else if (password == "")
                {
                    MessageBox.Show("Delete has been canceled by user.");
                }
                else
                {
                    MessageBox.Show("Wrong Password.");
                }
            }
            else
            {
                MessageBox.Show("Please select a product to delete");
            }
        }
コード例 #4
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (DialogConfirm.GetDialogResult("Desea guardar los cambios?", "Question").Equals(DialogResult.No))
            {
                return;
            }

            try
            {
                var categoryModel = new CategoryModel();
                categoryModel.IdCategory = _id;
                categoryModel.Category   = txtCategory.Text.Trim();

                SaveChanges(entityState, categoryModel);
            }
            catch (SqlException ex)
            {
                if (ex.Number == 2601 || ex.Number == 2627)
                {
                    DialogConfirm.GetDialogResult("No se puede ingresar registros duplicados", "Error");
                }
                else
                {
                    DialogConfirm.GetDialogResult(ex.Message, "Error");
                }
            }
            finally
            {
                GetCategory();
                ToBlockButtons();
            }
        }
コード例 #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                txtMsg.Text = "";
                if (lblIsEdit.Text == "1")
                {
                    string password  = DialogConfirm.ShowInputDialog("Please provide password to continue.", "Confirm with Password");
                    string finalPass = SecurityEncrypt.Decrypt(ConfigurationManager.AppSettings["CriticalSectionPassword"].ToString(), "nakshal");

                    if (password == finalPass)
                    {
                        Save();
                    }
                    else if (password == "")
                    {
                        MessageBox.Show("Save has been canceled by user.");
                    }
                    else
                    {
                        MessageBox.Show("Wrong Password.");
                    }
                }
                else
                {
                    Save();
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
コード例 #6
0
ファイル: frmUser.cs プロジェクト: franpaulinoinfante/Sale
 private void btnCancelar_Click(object sender, EventArgs e)
 {
     if (DialogConfirm.GetDialogResult("¿Está seguro qué desea cancelar la operación?", "Question").Equals(DialogResult.No))
     {
         return;
     }
     panelTextBox.Enabled = false;
 }
コード例 #7
0
 private void btnCancelar_Click(object sender, EventArgs e)
 {
     if (DialogConfirm.GetDialogResult("¿Está seguro qué desea cancelar la operación?", "Question").Equals(DialogResult.No))
     {
         return;
     }
     ToBlockButtons();
 }
コード例 #8
0
 private void btnEditar_Click(object sender, EventArgs e)
 {
     if (_indixe < 0)
     {
         DialogResult dialogResult = DialogConfirm.GetDialogResult("Debe elegir un registro", "Exclamation");
         return;
     }
     ToActiveButtons();
     entityState = EntityState.Edit;
 }
コード例 #9
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     if (_indixe < 0)
     {
         DialogConfirm.GetDialogResult("Debe seleccionar un registro", "Exclamation");
         return;
     }
     entityState = EntityState.Delete;
     btnGuardar_Click(this, e);
     //ToBlockButtons();
 }
コード例 #10
0
ファイル: frmUser.cs プロジェクト: franpaulinoinfante/Sale
        private void btnSalir_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = DialogConfirm.GetDialogResult("¿Está seguro qué desea salir?", "Question");

            if (dialogResult == DialogResult.Yes)
            {
                frmDashBoard frmDashBoard = new frmDashBoard();
                this.Close();
                frmDashBoard.Show();
            }
        }
コード例 #11
0
 private void GetCategory()
 {
     try
     {
         CategoryModel categoryModel = new CategoryModel();
         dgvCategory.DataSource = categoryModel.GetCategories();
     }
     catch (SqlException ex)
     {
         DialogConfirm.GetDialogResult(ex.Message, "Warning");
         return;
     }
 }
コード例 #12
0
 private static void ApplicationStart()
 {
     if (!Network.IsInternetConnected)
     {
         DialogConfirm.ShowInformationDialog("Internet is not there. Please connect to internet, then open again.", "Stone Age !!");
         Application.ExitThread();
         Application.Exit();
     }
     else
     {
         //DialogConfirm.ShowInfohScreen("Application is checking your system..." + Environment.NewLine + "Please Wait");
         try
         {
             ErrorEnum errType   = ErrorEnum.Other;
             string    errMsg    = string.Empty;
             bool      isSuccess = false;
             DBSaveManager.ApplicationStartDbFetch(out errType, out errMsg, out isSuccess);
             if (isSuccess)
             {
                 if (User.IsSuperadmin)
                 {
                     Application.Run(new FrmUserSelector());
                 }
                 else
                 {
                     Application.Run(new FrmLogin());
                 }
             }
             else if (errType.Equals(ErrorEnum.IpNotAllowed))
             {
                 DialogConfirm.ShowInformationDialog("Your IP is not allowed." + Environment.NewLine + " Please contact administrator to add your IP : " + Network.GetPublicIpAddress(), "IP not Allowed!");
             }
             else if (errType.Equals(ErrorEnum.MacNotAllowed))
             {
                 DialogConfirm.ShowInformationDialog("Your machine is not allowed." + Environment.NewLine + " Please contact administrator to add your machine : " + Network.GetActiveMACAddress(), "Machine not Allowed");
             }
             else
             {
                 Application.Run(new FrmSetup());
             }
         }
         catch (Exception ex)
         {
             Logger.LogError(ex);
         }
         //Thread mstDataThread = new Thread(new ThreadStart(FetchMasterData));
         //mstDataThread.Start();
     }
 }
コード例 #13
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            MasterDataHelper.FetchMasterData();
            string msg = string.Empty;

            if (UserHelper.DoLogin(User.LoginId, User.Password, User.AllowedMacId.Split(',').FirstOrDefault(), out msg))
            {
                Logger.LogInfo("Logged in disguise as user \"" + User.LoginId + "\"");
                FormHelper.OpenFrmRationcardHome();
                this.Visible = false;
            }
            else
            {
                Logger.LogInfo("unsuccessful Loging in disguise as user \"" + User.LoginId + "\"" + Environment.NewLine + msg);
                DialogConfirm.ShowInformationDialog("Couldnot login.", "Autologin");
            }
        }
コード例 #14
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                txtMsg.Text = "";
                string password  = DialogConfirm.ShowDialog("Please provide password to continue.", "Confirm with Password");
                string finalPass = SecurityEncrypt.Decrypt(ConfigurationManager.AppSettings["ActionConfirmPassword"].ToString(), "nakshal");

                if (password == finalPass)
                {
                    List <SqlParameter> sqlParams = new List <SqlParameter>();
                    sqlParams.Add(new SqlParameter {
                        ParameterName = "@userId", SqlDbType = SqlDbType.VarChar, Value = User.LoginId
                    });
                    sqlParams.Add(new SqlParameter {
                        ParameterName = "@rationCardId", SqlDbType = SqlDbType.VarChar, Value = lblRationCardId.Text
                    });
                    sqlParams.Add(new SqlParameter {
                        ParameterName = "@customerId", SqlDbType = SqlDbType.VarChar, Value = lblCustId.Text
                    });
                    DataSet ds = ConnectionManager.Exec("Sp_RationCard_Delete", sqlParams);
                    if ((ds != null) && (ds.Tables.Count > 0) && (ds.Tables[0].Rows.Count > 0))
                    {
                        txtMsg.Text = ds.Tables[0].Rows[0][1].ToString();
                        RefreshCatWiseCount();
                        ResetForm();
                        FetchFormData();
                    }
                }
                else if (password == "")
                {
                    MessageBox.Show("Delete has been canceled by user.");
                }
                else
                {
                    MessageBox.Show("Wrong Password.");
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex);
            }
        }
コード例 #15
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (DialogConfirm.GetDialogResult("Desea guardar los cambios", "Question").Equals(DialogResult.No))
            {
                return;
            }
            else
            {
                try
                {
                    var customerModel = new CustomerModel();
                    customerModel.IdCustomer      = _id;
                    customerModel.Lastname        = txtLastname.Text.Trim();
                    customerModel.Firstname       = txtFirstname.Text;
                    customerModel.Birthday        = dtpBirthday.Value;
                    customerModel.Gender          = txtGender.Text;
                    customerModel.Document        = mtbCID.Text;
                    customerModel.Phone           = mtbPhome.Text;
                    customerModel.CustomerAddress = txtDireccion.Text;
                    customerModel.Note            = txtNotas.Text;

                    SaveChanges(customerState, customerModel);
                }
                catch (SqlException ex)
                {
                    if (ex.Number == 2601 || ex.Number == 2627)
                    {
                        MessageBox.Show("ya tiene una Cedula registra con este mismo nuemero, la cedula de identidad no se puede duplicar");
                    }
                    else
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                finally
                {
                    ClearFields();
                    GetCustomer();
                }
            }
            ToBlockButtons();
        }
コード例 #16
0
        private void SaveChanges(Helps.EntityState entityState, CategoryModel categoryModel)
        {
            switch (entityState)
            {
            case EntityState.Add:
                categoryModel.InsertCategory();
                break;

            case EntityState.Edit:
                categoryModel.EditCategory();
                break;

            case EntityState.Delete:
                categoryModel.RemoveCategory();
                break;

            default:
                DialogConfirm.GetDialogResult("Debe Seleccionar la operación a realizar", "Exclamation");
                break;
            }
        }
コード例 #17
0
        private void SaveChanges(EntityState entityState, CustomerModel customerModel)
        {
            switch (entityState)
            {
            case EntityState.Add:
                customerModel.InsertCustomer();
                break;

            case EntityState.Edit:
                customerModel.EditCustomer();
                break;

            case EntityState.Delete:
                customerModel.DeleteCustomer();
                break;

            default:
                DialogConfirm.GetDialogResult("Debe Seleccionar la operación a realizar", "Exclamation");
                break;
            }
        }
コード例 #18
0
ファイル: frmUser.cs プロジェクト: franpaulinoinfante/Sale
        private void btnGuardar_Click_1(object sender, EventArgs e)
        {
            if (DialogConfirm.GetDialogResult("¿Desea guardar los Cambios", "Question").Equals(DialogResult.No))
            {
                return;
            }
            else
            {
                try
                {
                    UserModel userModel = new UserModel();
                    userModel.IdUser      = _id;
                    userModel.Lastname    = txtLastname.Text;
                    userModel.Firstname   = txtFirstname.Text;
                    userModel.Birthday    = dtpBirthday.Value;
                    userModel.Gender      = txtGender.Text;
                    userModel.Document    = mtbCID.Text;
                    userModel.Phone       = mtbPhome.Text;
                    userModel.UserAddress = txtAddress.Text;
                    userModel.Note        = txtNotes.Text;

                    SaveChanges(userState, userModel);
                }
                catch (SqlException ex)
                {
                    if (ex.Number == 2601 || ex.Number == 2627)
                    {
                        MessageBox.Show("ya tiene una Cedula registra con este mismo nuemero, la cedula de identidad no se puede duplicar");
                        return;
                    }
                }
                finally
                {
                    GetUsers();
                }
            }
        }