示例#1
0
        private void UpdateContact(Guid gCONTACT_ID, bool bUpdateBilling, bool bUpdateShipping)
        {
            string innerSql = ApplicationSQL.SQL["Invoices_EditView_267"].ToString();
            var    oQuery   = new InlineQueryDBManager();

            oQuery.CommandText = innerSql;
            oQuery.Add("@ID", SqlDbType.UniqueIdentifier, gCONTACT_ID);
            using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
            {
                if (rdr.Read())
                {
                    if (bUpdateBilling)
                    {
                        new DynamicControl(this, "BILLING_CONTACT_ID").ID     = CommonTypeConvert.ToGuid(rdr["ID"]);
                        new DynamicControl(this, "BILLING_CONTACT_NAME").Text = CommonTypeConvert.ToString(rdr["NAME"]);
                    }
                    if (bUpdateShipping)
                    {
                        new DynamicControl(this, "SHIPPING_CONTACT_ID").ID     = CommonTypeConvert.ToGuid(rdr["ID"]);
                        new DynamicControl(this, "SHIPPING_CONTACT_NAME").Text = CommonTypeConvert.ToString(rdr["NAME"]);
                    }
                    Guid gACCOUNT_ID = CommonTypeConvert.ToGuid(rdr["ACCOUNT_ID"]);
                    if (!CommonTypeConvert.IsEmptyGuid(gACCOUNT_ID))
                    {
                        UpdateAccount(gACCOUNT_ID, bUpdateBilling, bUpdateShipping);
                    }
                }
            }
        }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Refund")
     {
         Guid   gPAYMENTS_TRANSACTION_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
         var    oQuery   = new InlineQueryDBManager();
         string innerSql = ApplicationSQL.SQL["PaymentTransactions"].ToString();
         oQuery.CommandText = innerSql;
         TypeConvert.AppendParameter(oQuery, gPAYMENTS_TRANSACTION_ID, "ID", false);
         using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
         {
             if (rdr.Read())
             {
                 Guid    gCURRENCY_ID        = CommonTypeConvert.ToGuid(rdr["CURRENCY_ID"]);
                 Guid    gACCOUNT_ID         = CommonTypeConvert.ToGuid(rdr["ACCOUNT_ID"]);
                 Guid    gCREDIT_CARD_ID     = CommonTypeConvert.ToGuid(rdr["CREDIT_CARD_ID"]);
                 string  sINVOICE_NUMBER     = CommonTypeConvert.ToString(rdr["INVOICE_NUMBER"]);
                 Decimal dAMOUNT             = CommonTypeConvert.ToDecimal(rdr["AMOUNT"]);
                 string  sDESCRIPTION        = CommonTypeConvert.ToString(rdr["DESCRIPTION"]);
                 string  sTRANSACTION_NUMBER = CommonTypeConvert.ToString(rdr["TRANSACTION_NUMBER"]);
                 //CRM.Common.Charge.CC.Refund(Application, gID, gCURRENCY_ID, gACCOUNT_ID, gCREDIT_CARD_ID, Request.UserHostAddress, sINVOICE_NUMBER, sDESCRIPTION, dAMOUNT, sTRANSACTION_NUMBER);
                 BindGrid();
             }
         }
     }
 }
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Notes.Create":
                Response.Redirect("~/CRM/Notes/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Notes.Edit":
            {
                Guid gNOTE_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                Response.Redirect("~/CRM/Notes/edit.aspx?ID=" + gNOTE_ID);
                break;
            }

            case "Notes.Delete":
            {
                Guid gNOTE_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                CommonProcedure.NotesDelete(gNOTE_ID);
                BindGrid();
                break;
            }

            default:
                throw (new Exception("Unknown command: " + e.CommandName));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE"));

            var oQuery = new InlineQueryDBManager();

            string innerSql = "  from vwPRODUCTS_List" + ControlChars.CrLf;

            oQuery.CommandText = innerSql;
            CRMSecurity.Filter(oQuery, m_sMODULE, "list");
            grdMain.OrderByClause("NAME", "asc");
            ctlSearchView.SqlSearchClause(oQuery);
            Guid gACCOUNT_ID = CommonTypeConvert.ToGuid(Request["ACCOUNT_ID"]);

            if (!CommonTypeConvert.IsEmptyGuid(gACCOUNT_ID))
            {
                TypeConvert.AppendParameter(oQuery, gACCOUNT_ID, "ACCOUNT_ID");
            }
            oQuery.CommandText = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields)
                                 + oQuery.CommandText
                                 + grdMain.OrderByClause();
            DataTable dt = oQuery.GetTable();

            vwMain             = dt.DefaultView;
            grdMain.DataSource = vwMain;
            if (!IsPostBack)
            {
                grdMain.DataBind();
            }
        }
示例#5
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Notes.Create":
                Response.Redirect("~/CRM/Notes/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Notes.Edit":
            {
                Guid gNOTE_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                Response.Redirect("~/CRM/Notes/edit.aspx?ID=" + gNOTE_ID);
                break;
            }

            case "Notes.Remove":
            {
                Guid gNOTE_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                BindGrid();
                break;
            }

            default:
                break;
            }
        }
示例#6
0
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Save" || e.CommandName == "SaveNew")
     {
         if (Page.IsValid)
         {
             Guid gPARENT_ID = CommonTypeConvert.ToGuid(txtPARENT_ID.Value);
             if (gPARENT_ID == gID)
             {
                 gPARENT_ID = Guid.Empty;
             }
             CommonProcedure.spPRODUCT_CATEGORIES_Update(
                 ref gID
                 , gPARENT_ID
                 , txtNAME.Text
                 , txtDESCRIPTION.Text
                 , CommonTypeConvert.ToInteger(txtLIST_ORDER.Text)
                 );
             Cache.Remove("vwPRODUCT_CATEGORIES_LISTBOX");
             if (e.CommandName == "SaveNew")
             {
                 Response.Redirect("edit.aspx");
             }
             else
             {
                 Response.Redirect("Index.aspx");
             }
         }
     }
 }
示例#7
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Payments.Create":
                Response.Redirect("~/CRM/Payments/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Payments.Edit":
            {
                Guid gPAYMENT_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                Response.Redirect("~/CRM/Payments/edit.aspx?ID=" + gPAYMENT_ID);
                break;
            }

            case "Payments.Remove":
            {
                Guid gINVOICE_PAYMENT_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                CommonProcedure.InvoicesPAYMENTS_Delete(gINVOICE_PAYMENT_ID);
                BindGrid();
                break;
            }

            default:
                break;
            }
        }
        protected void PAYMENT_TYPE_Changed(object sender, EventArgs e)
        {
            var PAYMENT_TYPE = tblMain.FindControl("PAYMENT_TYPE") as DropDownList;

            if (PAYMENT_TYPE != null)
            {
                bool bCreditCard = PAYMENT_TYPE.SelectedValue == "Credit Card";
                ctlDynamicButtons.ShowButton("Charge", bCreditCard);
                new DynamicControl(this, "CREDIT_CARD_ID_LABEL").Visible     = bCreditCard;
                new DynamicControl(this, "CREDIT_CARD_NAME").Visible         = bCreditCard;
                new DynamicControl(this, "CREDIT_CARD_ID_btnChange").Visible = bCreditCard;
                new DynamicControl(this, "CREDIT_CARD_ID_btnClear").Visible  = bCreditCard;
                if (bCreditCard && CommonTypeConvert.IsEmptyGuid(new DynamicControl(this, "CREDIT_CARD_ID").ID))
                {
                    var    oQuery   = new InlineQueryDBManager();
                    string innerSql = ApplicationSQL.SQL["Payments_EditView_214"].ToString();
                    oQuery.CommandText = innerSql;
                    Guid gACCOUNT_ID = new DynamicControl(this, "ACCOUNT_ID").ID;
                    TypeConvert.AppendParameter(oQuery, gACCOUNT_ID, "ACCOUNT_ID", false);
                    using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (rdr.Read())
                        {
                            new DynamicControl(this, "CREDIT_CARD_ID").ID     = CommonTypeConvert.ToGuid(rdr["ID"]);
                            new DynamicControl(this, "CREDIT_CARD_NAME").Text = CommonTypeConvert.ToString(rdr["NAME"]);
                        }
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SetPageTitle(Translation.GetTranslation.Term(".moduleList." + m_sMODULE));
            Visible = (Security.GetUserAccess(m_sMODULE, "edit") >= 0);
            if (!Visible)
            {
                return;
            }

            gID = CommonTypeConvert.ToGuid(Request["ID"]);
            if (!IsPostBack)
            {
                ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);

                Guid gDuplicateID = CommonTypeConvert.ToGuid(Request["DuplicateID"]);
                if (!CommonTypeConvert.IsEmptyGuid(gID) || !CommonTypeConvert.IsEmptyGuid(gDuplicateID))
                {
                    var    oQuery   = new InlineQueryDBManager();
                    string innerSql = ApplicationSQL.SQL["Administration_ProductTemplates_EditView"].ToString();
                    oQuery.CommandText = innerSql;
                    if (!CommonTypeConvert.IsEmptyGuid(gDuplicateID))
                    {
                        oQuery.Add("@ID", SqlDbType.UniqueIdentifier, gDuplicateID);
                        gID = Guid.Empty;
                    }
                    else
                    {
                        oQuery.Add("@ID", SqlDbType.UniqueIdentifier, gID);
                    }

                    using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (rdr.Read())
                        {
                            ctlModuleHeader.Title = CommonTypeConvert.ToString(rdr["NAME"]);
                            SetPageTitle(Translation.GetTranslation.Term(".moduleList." + m_sMODULE) + " - " +
                                         ctlModuleHeader.Title);
                            Utils.UpdateTracker(Page, m_sMODULE, gID, ctlModuleHeader.Title);
                            ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;

                            AppendEditViewFields(m_sMODULE + ".EditView", tblMain, rdr);
                        }
                    }
                }
                else
                {
                    AppendEditViewFields(m_sMODULE + ".EditView", tblMain, null);
                }
            }
            else
            {
                ctlModuleHeader.Title = CommonTypeConvert.ToString(ViewState["ctlModuleHeader.Title"]);
                SetPageTitle(Translation.GetTranslation.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     gID = CommonTypeConvert.ToGuid(Request["ID"]);
     BindGrid();
     if (!IsPostBack)
     {
         Guid gASSIGNED_USER_ID = CommonTypeConvert.ToGuid(Page.Items["ASSIGNED_USER_ID"]);
         ctlDynamicButtonsOpen.AppendButtons("Invoices.Activities.Open", gASSIGNED_USER_ID, gID);
         ctlDynamicButtonsHistory.AppendButtons("Invoices.Activities.History", gASSIGNED_USER_ID, gID);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            gID = CommonTypeConvert.ToGuid(Request["ID"]);
            BindGrid();

            if (!IsPostBack)
            {
                Guid gASSIGNED_USER_ID = CommonTypeConvert.ToGuid(Page.Items["ASSIGNED_USER_ID"]);
                ctlDynamicButtons.AppendButtons("Payments." + m_sMODULE, gASSIGNED_USER_ID, gID);
            }
        }
        public void ProductUpdate(ref Guid gID, Guid gPRODUCT_TEMPLATE_ID, string sNAME, string sSTATUS,
                                  Guid gACCOUNT_ID, Guid gCONTACT_ID, Int32 nQUANTITY, DateTime dtDATE_PURCHASED,
                                  DateTime dtDATE_SUPPORT_EXPIRES, DateTime dtDATE_SUPPORT_STARTS, Guid gMANUFACTURER_ID,
                                  Guid gCATEGORY_ID, Guid gTYPE_ID, string sWEBSITE, string sMFT_PART_NUM,
                                  string sVENDOR_PART_NUM, string sSERIAL_NUMBER, string sASSET_NUMBER,
                                  string sTAX_CLASS, float flWEIGHT, Guid gCURRENCY_ID, decimal dCOST_PRICE,
                                  decimal dLIST_PRICE, decimal dBOOK_VALUE, DateTime dtBOOK_VALUE_DATE,
                                  decimal dDISCOUNT_PRICE, Int32 nPRICING_FACTOR, string sPRICING_FORMULA,
                                  string sSUPPORT_NAME, string sSUPPORT_CONTACT, string sSUPPORT_DESCRIPTION,
                                  string sSUPPORT_TERM, string sDESCRIPTION, Guid gTEAM_ID)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@ID", SqlDbType.UniqueIdentifier, ParameterDirection.InputOutput, gID);
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);
                oDm.Add("@PRODUCT_TEMPLATE_ID", SqlDbType.UniqueIdentifier, gPRODUCT_TEMPLATE_ID);
                oDm.Add("@NAME", SqlDbType.NVarChar, 50, sNAME);
                oDm.Add("@STATUS", SqlDbType.NVarChar, 25, sSTATUS);
                oDm.Add("@ACCOUNT_ID", SqlDbType.UniqueIdentifier, gACCOUNT_ID);
                oDm.Add("@CONTACT_ID", SqlDbType.UniqueIdentifier, gCONTACT_ID);
                oDm.Add("@QUANTITY", SqlDbType.Int, nQUANTITY);
                oDm.Add("@DATE_PURCHASED", SqlDbType.DateTime, dtDATE_PURCHASED);
                oDm.Add("@DATE_SUPPORT_EXPIRES", SqlDbType.DateTime, dtDATE_SUPPORT_EXPIRES); //DATE_COST_PRICE
                oDm.Add("@DATE_SUPPORT_STARTS", SqlDbType.DateTime, dtDATE_SUPPORT_STARTS);
                oDm.Add("@MANUFACTURER_ID", SqlDbType.UniqueIdentifier, gMANUFACTURER_ID);
                oDm.Add("@CATEGORY_ID", SqlDbType.UniqueIdentifier, gCATEGORY_ID);
                oDm.Add("@TYPE_ID", SqlDbType.UniqueIdentifier, gTYPE_ID);
                oDm.Add("@WEBSITE", SqlDbType.NVarChar, 255, sWEBSITE);
                oDm.Add("@MFT_PART_NUM", SqlDbType.NVarChar, 50, sMFT_PART_NUM);
                oDm.Add("@VENDOR_PART_NUM", SqlDbType.NVarChar, 50, sVENDOR_PART_NUM);
                oDm.Add("@SERIAL_NUMBER", SqlDbType.NVarChar, 50, sSERIAL_NUMBER);
                oDm.Add("@ASSET_NUMBER", SqlDbType.NVarChar, 50, sASSET_NUMBER);
                oDm.Add("TAX_CLASS", SqlDbType.NVarChar, 25, sTAX_CLASS);
                oDm.Add("@WEIGHT", SqlDbType.Float, 53, flWEIGHT);
                oDm.Add("@CURRENCY_ID", SqlDbType.UniqueIdentifier, gCURRENCY_ID);
                oDm.Add("@COST_PRICE", SqlDbType.Decimal, dCOST_PRICE); //--
                oDm.Add("@LIST_PRICE", SqlDbType.Decimal, dLIST_PRICE);
                oDm.Add("@BOOK_VALUE", SqlDbType.Money, dBOOK_VALUE);
                oDm.Add("@BOOK_VALUE_DATE", SqlDbType.DateTime, dtBOOK_VALUE_DATE);
                oDm.Add("@DISCOUNT_PRICE", SqlDbType.Decimal, dDISCOUNT_PRICE);
                oDm.Add("@PRICING_FACTOR", SqlDbType.Int, nPRICING_FACTOR);
                oDm.Add("@PRICING_FORMULA", SqlDbType.NVarChar, 25, sPRICING_FORMULA);
                oDm.Add("@SUPPORT_NAME", SqlDbType.NVarChar, 50, sSUPPORT_NAME);
                oDm.Add("@SUPPORT_CONTACT", SqlDbType.NVarChar, 50, sSUPPORT_CONTACT);
                oDm.Add("@SUPPORT_DESCRIPTION", SqlDbType.NVarChar, 255, sSUPPORT_DESCRIPTION);
                oDm.Add("@SUPPORT_TERM", SqlDbType.NVarChar, 25, sSUPPORT_TERM);
                oDm.Add("@DESCRIPTION", SqlDbType.Text, sDESCRIPTION);
                oDm.Add("@TeamID", SqlDbType.UniqueIdentifier, gTEAM_ID);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCTS_Update");
                gID = CommonTypeConvert.ToGuid(oDm["@ID"].Value);
            }
        }
示例#13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetPageTitle(Translation.GetTranslation.Term(".moduleList." + m_sMODULE));
            Visible = (Security.GetUserAccess(m_sMODULE, "view") >= 0);
            if (!Visible)
            {
                return;
            }


            gID = CommonTypeConvert.ToGuid(Request["ID"]);
            if (!IsPostBack)
            {
                if (!CommonTypeConvert.IsEmptyGuid(gID))
                {
                    string innerSql = ApplicationSQL.SQL["Invoices_EditView_323"].ToString();
                    var    oQuery   = new InlineQueryDBManager();

                    oQuery.CommandText = innerSql;
                    CRMSecurity.Filter(oQuery, m_sMODULE, "view");
                    TypeConvert.AppendParameter(oQuery, gID, "ID", false);

                    using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (rdr.Read())
                        {
                            ctlModuleHeader.Title = CommonTypeConvert.ToString(rdr["NAME"]);
                            SetPageTitle(Translation.GetTranslation.Term(".moduleList." + m_sMODULE) + " - " +
                                         ctlModuleHeader.Title);
                            Utils.UpdateTracker(Page, m_sMODULE, gID, ctlModuleHeader.Title);

                            AppendDetailViewFields(m_sMODULE + ".DetailView", tblMain, rdr, Page_Command);
                            AppendDetailViewFields(m_sMODULE + ".SummaryView", tblSummary, rdr, Page_Command);
                            Page.Items["ASSIGNED_USER_ID"] = CommonTypeConvert.ToGuid(rdr["ASSIGNED_USER_ID"]);
                            ctlDynamicButtons.AppendButtons(m_sMODULE + ".DetailView",
                                                            CommonTypeConvert.ToGuid(rdr["ASSIGNED_USER_ID"]), rdr);
                        }
                        else
                        {
                            plcSubPanel.Visible = false;
                            ctlDynamicButtons.AppendButtons(m_sMODULE + ".DetailView", Guid.Empty, null);
                            ctlDynamicButtons.DisableAll();
                            ctlDynamicButtons.ErrorText = Translation.GetTranslation.Term("ACL.LBL_NO_ACCESS");
                        }
                    }
                }
                else
                {
                    ctlDynamicButtons.AppendButtons(m_sMODULE + ".DetailView", Guid.Empty, null);
                    ctlDynamicButtons.DisableAll();
                }
            }
        }
        protected void grdMain_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (dtLineItems != null)
            {
                GridViewRow gr = grdMain.Rows[e.RowIndex];
                var         txtINVOICE_NAME        = gr.FindControl("INVOICE_NAME") as TextBox;
                var         txtINVOICE_ID          = gr.FindControl("INVOICE_ID") as HiddenField;
                var         txtAMOUNT_DUE          = gr.FindControl("AMOUNT_DUE") as TextBox;
                var         txtAMOUNT_DUE_USDOLLAR = gr.FindControl("AMOUNT_DUE_USDOLLAR") as HiddenField;
                var         txtAMOUNT          = gr.FindControl("AMOUNT") as TextBox;
                var         txtAMOUNT_USDOLLAR = gr.FindControl("AMOUNT_USDOLLAR") as HiddenField;

                DataRow row = dtLineItems.Rows[e.RowIndex];
                if (txtINVOICE_NAME != null)
                {
                    row["INVOICE_NAME"] = txtINVOICE_NAME.Text;
                }
                if (txtINVOICE_ID != null)
                {
                    row["INVOICE_ID"] = CommonTypeConvert.ToGuid(txtINVOICE_ID.Value);
                }
                if (txtAMOUNT != null)
                {
                    row["AMOUNT_DUE"] = CommonTypeConvert.ToDecimal(txtAMOUNT_DUE.Text);
                }
                if (txtAMOUNT != null)
                {
                    row["AMOUNT"] = CommonTypeConvert.ToDecimal(txtAMOUNT.Text);
                }

                row["AMOUNT_DUE_USDOLLAR"] =
                    Currency.GetCurrency.FromCurrency(CommonTypeConvert.ToDecimal(txtAMOUNT_DUE.Text));
                row["AMOUNT_USDOLLAR"] = Currency.GetCurrency.FromCurrency(CommonTypeConvert.ToDecimal(txtAMOUNT.Text));

                DataRow[] aCurrentRows = dtLineItems.Select(String.Empty, String.Empty, DataViewRowState.CurrentRows);
                if (aCurrentRows.Length == 0 ||
                    !CommonTypeConvert.IsEmptyString(aCurrentRows[aCurrentRows.Length - 1]["INVOICE_NAME"]))
                {
                    DataRow rowNew = dtLineItems.NewRow();
                    dtLineItems.Rows.Add(rowNew);
                    aCurrentRows = dtLineItems.Select(String.Empty, String.Empty, DataViewRowState.CurrentRows);
                }

                ViewState["LineItems"] = dtLineItems;
                grdMain.DataSource     = dtLineItems;
                grdMain.EditIndex      = aCurrentRows.Length - 1;
                grdMain.DataBind();
                UpdateTotals();
                UpdatePaymentAmount();
            }
        }
示例#15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetPageTitle(Translation.GetTranslation.Term("Manufacturers.LBL_NAME"));
            Visible = Security.IS_ADMIN;
            Visible = Security.ADMIN_TYPE == 0 ? true : false;
            if (!Visible)
            {
                return;
            }

            reqNAME.DataBind();
            reqLIST_ORDER.DataBind();
            gID = CommonTypeConvert.ToGuid(Request["ID"]);
            if (!IsPostBack)
            {
                ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);

                lstSTATUS.DataSource = CRMCache.List("manufacturer_status_dom");
                lstSTATUS.DataBind();
                if (!CommonTypeConvert.IsEmptyGuid(gID))
                {
                    var    oQuery   = new InlineQueryDBManager();
                    string innerSql = ApplicationSQL.SQL["Administration_Manufacturers_EditView"].ToString();
                    oQuery.CommandText = innerSql;
                    oQuery.Add("@ID", SqlDbType.UniqueIdentifier, gID);

                    using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (rdr.Read())
                        {
                            txtNAME.Text        = CommonTypeConvert.ToString(rdr["NAME"]);
                            ctlListHeader.Title = Translation.GetTranslation.Term("Manufacturers.LBL_NAME") + " " +
                                                  txtNAME.Text;
                            txtLIST_ORDER.Text = CommonTypeConvert.ToString(rdr["LIST_ORDER"]);

                            lstSTATUS.SelectedValue = CommonTypeConvert.ToString(rdr["STATUS"]);
                        }
                    }
                }
                else
                {
                    var    oQuery   = new InlineQueryDBManager();
                    string innerSql = ApplicationSQL.SQL["Manufacturers_EditView_113"].ToString();
                    oQuery.CommandText = innerSql;

                    txtLIST_ORDER.Text = (CommonTypeConvert.ToInteger(oQuery.ExecuteScalar()) + 1).ToString();
                }
            }
        }
        public void ProductTypesUpdate(ref Guid gID, string sNAME, string sDESCRIPTION, Int32 nLIST_ORDER)
        {
            using (var oDm = new DataManager())
            {
                oDm.Add("@ID", SqlDbType.UniqueIdentifier, ParameterDirection.InputOutput, gID);
                oDm.Add("@MODIFIED_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID);
                oDm.Add("@NAME", SqlDbType.NVarChar, sNAME);
                oDm.Add("@DESCRIPTION", SqlDbType.NVarChar, 50, sDESCRIPTION);
                oDm.Add("@LIST_ORDER", SqlDbType.Int, nLIST_ORDER);

                oDm.CommandType = CommandType.StoredProcedure;
                oDm.ExecuteNonQuery("stp_Zpro_PRODUCT_TYPES_Update");
                gID = CommonTypeConvert.ToGuid(oDm["@ID"].Value);
            }
        }
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Invoices.Edit":
            {
                Guid gINVOICE_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                Response.Redirect("~/CRM/Invoices/edit.aspx?ID=" + gINVOICE_ID);
                break;
            }

            default:
                throw (new Exception("Unknown command: " + e.CommandName));
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     GetCurrencyControl();
     if (IsPostBack)
     {
         if (CURRENCY_ID.Items.Count > 0)
         {
             Guid gCURRENCY_ID = CommonTypeConvert.ToGuid(CURRENCY_ID.SelectedValue);
             SetCurrency(gCURRENCY_ID, CommonTypeConvert.ToFloat(EXCHANGE_RATE.Value));
             EXCHANGE_RATE.Value = Currency.GetCurrency.CONVERSION_RATE.ToString();
         }
         dtLineItems        = ViewState["LineItems"] as DataTable;
         grdMain.DataSource = dtLineItems;
     }
 }
示例#19
0
        public LineItem GetItemDetailsByNumber(Guid gCURRENCY_ID, string sMFT_PART_NUM)
        {
            var item = new LineItem();

            {
                if (Security.USER_ID == Guid.Empty)
                {
                    throw (new Exception("Authentication required"));
                }

                var oQuery = new InlineQueryDBManager();
                oQuery.CommandText = ApplicationSQL.SQL["ProductCatalog_AutoComplete_63"].ToString();

                CRMSecurity.Filter(oQuery, "ProductTemplates", "list");
                TypeConvert.AppendParameter(oQuery, sMFT_PART_NUM, CommonTypeConvert.SqlFilterMode.StartsWith,
                                            "MFT_PART_NUM");
                oQuery.CommandText += " order by MFT_PART_NUM" + ControlChars.CrLf;
                using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                {
                    if (rdr.Read())
                    {
                        item.ID              = CommonTypeConvert.ToGuid(rdr["ID"]);
                        item.NAME            = CommonTypeConvert.ToString(rdr["NAME"]);
                        item.MFT_PART_NUM    = CommonTypeConvert.ToString(rdr["MFT_PART_NUM"]);
                        item.VENDOR_PART_NUM = CommonTypeConvert.ToString(rdr["VENDOR_PART_NUM"]);
                        item.TAX_CLASS       = CommonTypeConvert.ToString(rdr["TAX_CLASS"]);
                        item.COST_PRICE      = CommonTypeConvert.ToDecimal(rdr["COST_PRICE"]);
                        item.COST_USDOLLAR   = CommonTypeConvert.ToDecimal(rdr["COST_USDOLLAR"]);
                        item.LIST_PRICE      = CommonTypeConvert.ToDecimal(rdr["LIST_PRICE"]);
                        item.LIST_USDOLLAR   = CommonTypeConvert.ToDecimal(rdr["LIST_USDOLLAR"]);
                        item.UNIT_PRICE      = CommonTypeConvert.ToDecimal(rdr["UNIT_PRICE"]);
                        item.UNIT_USDOLLAR   = CommonTypeConvert.ToDecimal(rdr["UNIT_USDOLLAR"]);
                        if (gCURRENCY_ID != CommonTypeConvert.ToGuid(rdr["CURRENCY_ID"]))
                        {
                            Currency C10n = Currency.CreateCurrency(gCURRENCY_ID);
                            item.COST_PRICE = Currency.GetCurrency.ToCurrency(item.COST_USDOLLAR);
                            item.LIST_PRICE = Currency.GetCurrency.ToCurrency(item.LIST_USDOLLAR);
                            item.UNIT_PRICE = Currency.GetCurrency.ToCurrency(item.UNIT_USDOLLAR);
                        }
                    }
                }
                if (CommonTypeConvert.IsEmptyGuid(item.ID))
                {
                    throw (new Exception("Item not found"));
                }
            }
            return(item);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            gID = CommonTypeConvert.ToGuid(Request["ID"]);
            Guid gPRODUCT_TEMPLATE_ID = CommonTypeConvert.ToGuid(txtPRODUCT_TEMPLATE_ID.Value);

            if (!CommonTypeConvert.IsEmptyGuid(gPRODUCT_TEMPLATE_ID))
            {
                txtPRODUCT_TEMPLATE_ID.Value = String.Empty;
            }
            BindGrid();

            if (!IsPostBack)
            {
                ctlDynamicButtons.AppendButtons("ProductTemplates.RelatedProducts", Guid.Empty, gID);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            gID = CommonTypeConvert.ToGuid(Request["ID"]);
            Guid gCHILD_ID = CommonTypeConvert.ToGuid(txtCHILD_ID.Value);

            if (!CommonTypeConvert.IsEmptyGuid(gCHILD_ID))
            {
                CommonProcedure.ProductProductUpdate(gID, gCHILD_ID);
                txtCHILD_ID.Value = String.Empty;
            }
            BindGrid();

            if (!IsPostBack)
            {
                Guid gASSIGNED_USER_ID = CommonTypeConvert.ToGuid(Page.Items["ASSIGNED_USER_ID"]);
                ctlDynamicButtons.AppendButtons(m_sMODULE + ".RelatedProducts", gASSIGNED_USER_ID, gID);
            }
        }
示例#22
0
        private void UpdateAccount(Guid gACCOUNT_ID, bool bUpdateBilling, bool bUpdateShipping)
        {
            string innerSql = ApplicationSQL.SQL["Invoices_EditView_223"].ToString();
            var    oQuery   = new InlineQueryDBManager();

            oQuery.CommandText = innerSql;
            oQuery.Add("@ID", SqlDbType.UniqueIdentifier, gACCOUNT_ID);
            using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
            {
                if (rdr.Read())
                {
                    if (bUpdateBilling)
                    {
                        new DynamicControl(this, "BILLING_ACCOUNT_ID").ID       = CommonTypeConvert.ToGuid(rdr["ID"]);
                        new DynamicControl(this, "BILLING_ACCOUNT_NAME").Text   = CommonTypeConvert.ToString(rdr["NAME"]);
                        new DynamicControl(this, "BILLING_ADDRESS_STREET").Text =
                            CommonTypeConvert.ToString(rdr["BILLING_ADDRESS_STREET"]);
                        new DynamicControl(this, "BILLING_ADDRESS_CITY").Text =
                            CommonTypeConvert.ToString(rdr["BILLING_ADDRESS_CITY"]);
                        new DynamicControl(this, "BILLING_ADDRESS_STATE").Text =
                            CommonTypeConvert.ToString(rdr["BILLING_ADDRESS_STATE"]);
                        new DynamicControl(this, "BILLING_ADDRESS_POSTALCODE").Text =
                            CommonTypeConvert.ToString(rdr["BILLING_ADDRESS_POSTALCODE"]);
                        new DynamicControl(this, "BILLING_ADDRESS_COUNTRY").Text =
                            CommonTypeConvert.ToString(rdr["BILLING_ADDRESS_COUNTRY"]);
                    }
                    if (bUpdateShipping)
                    {
                        new DynamicControl(this, "SHIPPING_ACCOUNT_ID").ID       = CommonTypeConvert.ToGuid(rdr["ID"]);
                        new DynamicControl(this, "SHIPPING_ACCOUNT_NAME").Text   = CommonTypeConvert.ToString(rdr["NAME"]);
                        new DynamicControl(this, "SHIPPING_ADDRESS_STREET").Text =
                            CommonTypeConvert.ToString(rdr["SHIPPING_ADDRESS_STREET"]);
                        new DynamicControl(this, "SHIPPING_ADDRESS_CITY").Text =
                            CommonTypeConvert.ToString(rdr["SHIPPING_ADDRESS_CITY"]);
                        new DynamicControl(this, "SHIPPING_ADDRESS_STATE").Text =
                            CommonTypeConvert.ToString(rdr["SHIPPING_ADDRESS_STATE"]);
                        new DynamicControl(this, "SHIPPING_ADDRESS_POSTALCODE").Text =
                            CommonTypeConvert.ToString(rdr["SHIPPING_ADDRESS_POSTALCODE"]);
                        new DynamicControl(this, "SHIPPING_ADDRESS_COUNTRY").Text =
                            CommonTypeConvert.ToString(rdr["SHIPPING_ADDRESS_COUNTRY"]);
                    }
                }
            }
        }
        public void CURRENCY_ID_Changed(object sender, EventArgs e)
        {
            Guid gCURRENCY_ID = CommonTypeConvert.ToGuid(CURRENCY_ID.SelectedValue);

            SetCurrency(gCURRENCY_ID);
            EXCHANGE_RATE.Value = Currency.GetCurrency.CONVERSION_RATE.ToString();

            foreach (DataRow row in dtLineItems.Rows)
            {
                if (row.RowState != DataRowState.Deleted)
                {
                    row["AMOUNT"] = Currency.GetCurrency.ToCurrency(CommonTypeConvert.ToDecimal(row["AMOUNT_USDOLLAR"]));
                }
            }
            grdMain.DataBind();

            UpdateTotals();
            UpdatePaymentAmount();
        }
示例#24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetPageTitle(Translation.GetTranslation.Term("ProductTypes.LBL_NAME"));
            if (!Visible)
            {
                return;
            }

            reqNAME.DataBind();
            reqLIST_ORDER.DataBind();
            gID = CommonTypeConvert.ToGuid(Request["ID"]);
            if (!IsPostBack)
            {
                ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);
                if (!CommonTypeConvert.IsEmptyGuid(gID))
                {
                    var    oQuery   = new InlineQueryDBManager();
                    string innerSql = ApplicationSQL.SQL["Administration_ProductTypes_EditView"].ToString();
                    oQuery.CommandText = innerSql;
                    oQuery.Add("@ID", SqlDbType.UniqueIdentifier, gID);

                    using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (rdr.Read())
                        {
                            txtNAME.Text        = CommonTypeConvert.ToString(rdr["NAME"]);
                            ctlListHeader.Title = Translation.GetTranslation.Term("ProductTypes.LBL_NAME") + " " +
                                                  txtNAME.Text;
                            txtDESCRIPTION.Text = CommonTypeConvert.ToString(rdr["DESCRIPTION"]);
                            txtLIST_ORDER.Text  = CommonTypeConvert.ToString(rdr["LIST_ORDER"]);
                        }
                    }
                }
                else
                {
                    var    oQuery   = new InlineQueryDBManager();
                    string innerSql = ApplicationSQL.SQL["ProductTypes_EditView_104"].ToString();
                    oQuery.CommandText = innerSql;
                    txtLIST_ORDER.Text = (CommonTypeConvert.ToInteger(oQuery.ExecuteScalar()) + 1).ToString();
                }
            }
        }
示例#25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            gID = CommonTypeConvert.ToGuid(Request["ID"]);

            string innerSql = ApplicationSQL.SQL["Invoices_LineItems"].ToString();
            var    oQuery   = new InlineQueryDBManager();

            oQuery.CommandText = innerSql;
            TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID", false);
            oQuery.CommandText += " order by POSITION asc" + ControlChars.CrLf;


            using (DataTable dt = oQuery.GetTable())
            {
                vwMain             = dt.DefaultView;
                grdMain.DataSource = vwMain;
                {
                    grdMain.DataBind();
                }
            }
        }
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Tasks.Create":
                Response.Redirect("~/CRM/Tasks/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Meetings.Create":
                Response.Redirect("~/CRM/Meetings/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Calls.Create":
                Response.Redirect("~/CRM/Calls/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Emails.Compose":
                Response.Redirect("~/CRM/Emails/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Notes.Create":
                Response.Redirect("~/CRM/Notes/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Emails.Archive":
                Response.Redirect("~/CRM/Emails/edit.aspx?PARENT_ID=" + gID);
                break;

            case "Activities.Delete":
            {
                Guid gACTIVITY_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                CommonProcedure.ActivitiesDelete(gACTIVITY_ID);
                BindGrid();
                break;
            }

            default:
                break;
            }
        }
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "ProductTemplates.Edit":
            {
                Guid gPRODUCT_TEMPLATE_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                Response.Redirect("~/CRM/ProductTemplates/edit.aspx?ID=" + gPRODUCT_TEMPLATE_ID);
                break;
            }

            case "ProductTemplates.Remove":
            {
                Guid gPRODUCT_TEMPLATE_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                BindGrid();
                break;
            }

            default:
                break;
            }
        }
示例#28
0
        public Invoice GetInvoiceByName(Guid gCURRENCY_ID, string sNAME)
        {
            var item = new Invoice();

            {
                if (Security.USER_ID == Guid.Empty)
                {
                    throw (new Exception("Authentication required"));
                }

                var    oQuery   = new InlineQueryDBManager();
                string innerSql = ApplicationSQL.SQL["Invoices_AutoComplete_50"].ToString();

                oQuery.CommandText = innerSql;
                CRMSecurity.Filter(oQuery, "Invoices", "list");
                TypeConvert.AppendParameter(oQuery, sNAME, CommonTypeConvert.SqlFilterMode.StartsWith, "NAME");
                using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                {
                    if (rdr.Read())
                    {
                        item.ID                  = CommonTypeConvert.ToGuid(rdr["ID"]);
                        item.NAME                = CommonTypeConvert.ToString(rdr["NAME"]);
                        item.AMOUNT_DUE          = CommonTypeConvert.ToDecimal(rdr["AMOUNT_DUE"]);
                        item.AMOUNT_DUE_USDOLLAR = CommonTypeConvert.ToDecimal(rdr["AMOUNT_DUE_USDOLLAR"]);
                        if (gCURRENCY_ID != CommonTypeConvert.ToGuid(rdr["CURRENCY_ID"]))
                        {
                            Currency C10n = Currency.CreateCurrency(gCURRENCY_ID);
                            item.AMOUNT_DUE = Currency.GetCurrency.ToCurrency(item.AMOUNT_DUE_USDOLLAR);
                        }
                    }
                }
                if (CommonTypeConvert.IsEmptyGuid(item.ID))
                {
                    throw (new Exception("Item not found"));
                }
            }
            return(item);
        }
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Products.Edit":
            {
                Guid gPRODUCT_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                Response.Redirect("~/CRM/Products/edit.aspx?ID=" + gPRODUCT_ID);
                break;
            }

            case "Products.Remove":
            {
                Guid gCHILD_ID = CommonTypeConvert.ToGuid(e.CommandArgument);
                CommonProcedure.ProductProductDelete(gID, gCHILD_ID);
                BindGrid();
                break;
            }

            default:
                throw (new Exception("Unknown command: " + e.CommandName));
            }
        }
        protected void BindGrid()
        {
            var    oQuery   = new InlineQueryDBManager();
            string innerSql = ApplicationSQL.SQL["Products_relatedProducts_58"].ToString();

            oQuery.CommandText = innerSql;
            oQuery.Add("@ID", SqlDbType.UniqueIdentifier, gID);

            gACCOUNT_ID = CommonTypeConvert.ToGuid(oQuery.ExecuteScalar());

            innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields)
                       + "  from vwPRODUCTS_RELATED_PRODUCTS" + ControlChars.CrLf
                       + " where 1 = 1                      " + ControlChars.CrLf;

            oQuery.CommandText = innerSql;
            TypeConvert.AppendParameter(oQuery, gID, "PARENT_ID");
            oQuery.CommandText += grdMain.OrderByClause("DATE_ENTERED", "desc");
            DataTable dt = oQuery.GetTable();

            vwMain             = dt.DefaultView;
            grdMain.DataSource = vwMain;
            grdMain.DataBind();
        }