示例#1
0
        /// <summary>
        /// Gets all settings.
        /// </summary>
        /// <returns></returns>
        public static DataTable GetAllSettings()
        {
            SoftwareSettings softwareSetting = new SoftwareSettings();

            softwareSetting.LoadAll();
            return(softwareSetting.DataTable);
        }
        private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            DataRow dr = grdSettingsView.GetFocusedDataRow();
             if (dr != null)
             {
                 int selected = Convert.ToInt32(dr["ID"]);
                 SoftwareSettings softwareSetting = new SoftwareSettings();
                 softwareSetting.LoadByPrimaryKey(selected);
                 softwareSetting.Value = dr["Value"].ToString();
                 softwareSetting.Save();

             }
        }
 /// <summary>
 /// Sets the value.
 /// </summary>
 /// <param name="settingName">Name of the setting.</param>
 /// <param name="value">The value.</param>
 public static void SetValue(string settingName, string value)
 {
     SoftwareSettings settings = new SoftwareSettings();
     settings.Where.Name.Value = settingName;
     settings.Query.Load();
     if (settings.RowCount > 0)
     {
         settings.Value = value;
         settings.Save();
     }
     else
     {
         settings.FlushData();
         settings.AddNew();
         settings.Name = settingName;
         settings.Value = value;
         settings.Save();
     }
 }
示例#4
0
        /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="settingName">Name of the setting.</param>
        /// <param name="value">The value.</param>
        public static void SetValue(string settingName, string value)
        {
            SoftwareSettings settings = new SoftwareSettings();

            settings.Where.Name.Value = settingName;
            settings.Query.Load();
            if (settings.RowCount > 0)
            {
                settings.Value = value;
                settings.Save();
            }
            else
            {
                settings.FlushData();
                settings.AddNew();
                settings.Name  = settingName;
                settings.Value = value;
                settings.Save();
            }
        }
        /// <summary>
        /// It will return all Invoice For Now
        /// </summary>
        /// <returns></returns>
        public static DataView GetIncompleteInvoices(int userID, int poTypeID, int documentTypeID)
        {
            SoftwareSettings softwareSetting = new SoftwareSettings();
            ReceiptInvoice   Invoice         = new ReceiptInvoice();

            var  settingDT = softwareSetting.GetValue("IsElectronicReceiveOnly");
            bool isNonElectronicReceiveOnly = true;

            if (settingDT.Rows.Count != 0)
            {
                isNonElectronicReceiveOnly = bool.Parse(settingDT.Rows[0].Field <string>("Value").ToLower());
            }

            var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetIncompleteInvoices(userID, isNonElectronicReceiveOnly, poTypeID, documentTypeID);

            Invoice.LoadFromRawSql(query);


            return(Invoice.DefaultView);
        }
 /// <summary>
 /// Gets all settings.
 /// </summary>
 /// <returns></returns>
 public static DataTable GetAllSettings()
 {
     SoftwareSettings softwareSetting = new SoftwareSettings();
     softwareSetting.LoadAll();
     return softwareSetting.DataTable;
 }
 private void LoadIsPOElectronicSetting()
 {
     var softwareSetting = new SoftwareSettings();
     var settingDT = softwareSetting.GetValue("IsElectronicReceiveOnly");
     if (settingDT.Rows.Count != 0)
     {
         _isNonElectronicReceiveOnly = bool.Parse(settingDT.Rows[0].Field<string>("Value").ToLower());
     }
 }
        /// <summary>
        /// It will return all Invoice For Now
        /// </summary>
        /// <returns></returns>
        public static DataView GetIncompleteInvoices(int userID, int poTypeID, int documentTypeID)
        {
            SoftwareSettings softwareSetting = new SoftwareSettings();
            ReceiptInvoice Invoice = new ReceiptInvoice();

            var settingDT = softwareSetting.GetValue("IsElectronicReceiveOnly");
            bool isNonElectronicReceiveOnly = true;

            if (settingDT.Rows.Count != 0)
            {
                isNonElectronicReceiveOnly = bool.Parse(settingDT.Rows[0].Field<string>("Value").ToLower());
            }

            var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetIncompleteInvoices(userID, isNonElectronicReceiveOnly,poTypeID,documentTypeID);
            Invoice.LoadFromRawSql(query);

            return Invoice.DefaultView;
        }
        private void btnConfirmIssue_Click(object sender, EventArgs e)
        {
            var Instance = new SoftwareSettings();
            Instance.GetValue("IsCenter");
            dxValidationProvider1.Validate();
            BLL.Issue stv = new BLL.Issue();
            stv.LoadByPrimaryKey(_activeSTVID);
            // bool isValid = dxValidationProvider1.Validate();
            var activity = new Activity();
            activity.LoadByPrimaryKey(stv.StoreID);

            if (activity.IsHealthProgram()) // if (!isValid && Mode.IsFreeStore(stv.StoreID))
            {
                dxValidationProvider1.RemoveControlError(txtPreprintedInvoiceNo);
            }

            if (Convert.ToBoolean(Instance.Value)) // When IsCenter is true. txtPreprintedInvoiceNo should be disabled as a requirment
            {
                dxValidationProvider1.RemoveControlError(txtPreprintedInvoiceNo);
            }

            if (Convert.ToBoolean(Instance.Value) && !activity.IsHealthProgram())
            {
                dxValidationProvider1.RemoveControlError(txtPreprintedInvoiceNo);
            }
            if (!Convert.ToBoolean(Instance.Value) && !activity.IsHealthProgram())  //   if (!isValid && !Mode.IsFreeStore(stv.StoreID))
            {
                if (!dxValidationProvider1.Validate())
                    return;
                //XtraMessageBox.Show("Please input the required fields.", "Required Fields Missing", MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
                //return;
            }
            if (XtraMessageBox.Show("Are you sure you want to confirm this dispatch?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                MyGeneration.dOOdads.TransactionMgr mgr = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
                try
                {
                    mgr.BeginTransaction();
                    //Mark the dispatch as confirmed. (Store the differences in the dispatched values somewhere)
                    int? preprintedID;
                    if (txtPreprintedInvoiceNo.Text == "")
                        preprintedID = null;
                    else
                        preprintedID = int.Parse(txtPreprintedInvoiceNo.Text);

                    if (!stv.MarkAsDispatched(CurrentContext.UserId, preprintedID))
                    {
                        XtraMessageBox.Show("Void request has been sent for this STV, you can't dispatch it!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        throw new Exception("Void request sent on this STV number");
                    }
                    if (_discrepancyIssueDoc.Count > 0)
                    {
                        //Save the discrepancies.
                        BLL.IssueDoc.RecordDiscrepancy(_discrepancyIssueDoc);
                    }
                    this.LogActivity("Confirm-Dispatch", _activeSTVID);
                    mgr.CommitTransaction();
                    XtraMessageBox.Show("STV marked as dispatched!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception exp)
                {
                    mgr.RollbackTransaction();
                    XtraMessageBox.Show("System couldn't save the dispatch, Please contact administrator", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    ErrorHandler.Handle(exp);
                }
                BindUnconfirmedIssues();
                gridUndispatchedIssueDetails.DataSource = null;
            }
        }