コード例 #1
0
        protected void btnProductChanged_Clicked(object sender, EventArgs e)
        {
            var    oQuery   = new InlineQueryDBManager();
            string innerSql = ApplicationSQL.SQL["Products_EditView_161"].ToString();

            oQuery.CommandText = innerSql;
            Guid gPRODUCT_TEMPLATE_ID = new DynamicControl(this, "PRODUCT_TEMPLATE_ID").ID;

            TypeConvert.AppendParameter(oQuery, gPRODUCT_TEMPLATE_ID, "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);
                    ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;

                    CRMDynamic.SetEditViewFields(this, m_sMODULE + ".EditView", rdr);
                    CRMDynamic.SetEditViewFields(this, m_sMODULE + ".CostView", rdr);
                    CRMDynamic.SetEditViewFields(this, m_sMODULE + ".MftView", rdr);
                    var txtNAME = FindControl("NAME") as TextBox;
                    if (txtNAME != null)
                    {
                        txtNAME.ReadOnly = false;
                    }
                }
            }
        }
コード例 #2
0
 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();
             }
         }
     }
 }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
        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"]);
                        }
                    }
                }
            }
        }
コード例 #5
0
        public string[] ItemNameList(string prefixText, int count)
        {
            var arrItems = new string[0];

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

            var oQuery = new InlineQueryDBManager();

            oQuery.CommandText = ApplicationSQL.SQL["ProductCatalog_AutoComplete_212"].ToString();
            CRMSecurity.Filter(oQuery, "ProductTemplates", "list");
            TypeConvert.AppendParameter(oQuery, prefixText, CommonTypeConvert.SqlFilterMode.StartsWith, "NAME");
            oQuery.CommandText += " order by NAME" + ControlChars.CrLf;

            using (DataTable dt = oQuery.GetTable())
            {
                arrItems = new string[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    arrItems[i] = CommonTypeConvert.ToString(dt.Rows[i]["NAME"]);
                }
            }


            return(arrItems);
        }
コード例 #6
0
        protected void BindGrid()
        {
            string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields)
                              + "  from vwINVOICES_ACTIVITIES" + ControlChars.CrLf;
            var oQuery = new InlineQueryDBManager();

            oQuery.CommandText = innerSql;
            CRMSecurity.Filter(oQuery, m_sMODULE, "list", "ACTIVITY_ASSIGNED_USER_ID");
            TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID");
            TypeConvert.AppendParameter(oQuery, true, "IS_OPEN", false);
            oQuery.CommandText += grdOpen.OrderByClause("DATE_DUE", "desc");


            using (DataTable dt = oQuery.GetTable())
            {
                foreach (DataRow row in dt.Rows)
                {
                    switch (CommonTypeConvert.ToString(row["ACTIVITY_TYPE"]))
                    {
                    case "Calls":
                        row["STATUS"] = Translation.GetTranslation.Term(".call_direction_dom.", row["DIRECTION"]) +
                                        " " + Translation.GetTranslation.Term(".call_status_dom.", row["STATUS"]);
                        break;
                    }
                }
                vwOpen             = new DataView(dt);
                grdOpen.DataSource = vwOpen;
                grdOpen.DataBind();
            }


            oQuery.CommandText = innerSql;
            CRMSecurity.Filter(oQuery, m_sMODULE, "list", "ACTIVITY_ASSIGNED_USER_ID");
            TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID");
            TypeConvert.AppendParameter(oQuery, false, "IS_OPEN", false);
            oQuery.CommandText += grdHistory.OrderByClause("DATE_MODIFIED", "desc");


            using (DataTable dt = oQuery.GetTable())
            {
                foreach (DataRow row in dt.Rows)
                {
                    switch (CommonTypeConvert.ToString(row["ACTIVITY_TYPE"]))
                    {
                    case "Calls":
                        row["STATUS"] = Translation.GetTranslation.Term(".call_direction_dom.", row["DIRECTION"]) +
                                        " " + Translation.GetTranslation.Term(".call_status_dom.", row["STATUS"]);
                        break;
                    }
                }
                vwHistory             = new DataView(dt);
                grdHistory.DataSource = vwHistory;
                grdHistory.DataBind();
            }
        }
コード例 #7
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();
                }
            }
        }
コード例 #8
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);
        }
コード例 #9
0
        protected void BindGrid()
        {
            var    oQuery   = new InlineQueryDBManager();
            string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields)
                              + "  from vwPRODUCT_TEMPLATES_PRODUCT_TEMPLATES" + ControlChars.CrLf
                              + " where 1 = 1                                " + ControlChars.CrLf;

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

            vwMain             = dt.DefaultView;
            grdMain.DataSource = vwMain;
            grdMain.DataBind();
        }
コード例 #10
0
        protected void BindGrid()
        {
            string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields)
                              + "  from vwINVOICES_PAYMENTS" + ControlChars.CrLf;
            var oQuery = new InlineQueryDBManager();

            oQuery.CommandText = innerSql;
            CRMSecurity.Filter(oQuery, m_sMODULE, "list");
            TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID");
            oQuery.CommandText += grdMain.OrderByClause("DATE_ENTERED", "desc");

            using (DataTable dt = oQuery.GetTable())
            {
                vwMain             = dt.DefaultView;
                grdMain.DataSource = vwMain;
                grdMain.DataBind();
            }
        }
コード例 #11
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();
                }
            }
        }
コード例 #12
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);
        }
コード例 #13
0
        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();
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE"));
            Visible = (Security.GetUserAccess(m_sMODULE, "list") >= 0);
            if (!Visible)
            {
                return;
            }

            var    oQuery   = new InlineQueryDBManager();
            string innerSql = "  from vwPRODUCT_TEMPLATES_List" + ControlChars.CrLf
                              + " where 1 = 1                   " + ControlChars.CrLf;

            oQuery.CommandText = innerSql;
            int nACLACCESS = Security.GetUserAccess(m_sMODULE, "list");

            if (nACLACCESS == ACL_ACCESS.OWNER)
            {
                TypeConvert.AppendParameter(oQuery, Security.USER_ID, "ASSIGNED_USER_ID", false);
            }
            grdMain.OrderByClause("NAME", "asc");
            ctlSearchView.SqlSearchClause(oQuery);
            oQuery.CommandText = "select " +
                                 (Request.Form[ctlExportHeader.ExportUniqueID] != null
                                      ? "*"
                                      : CommonTypeConvert.FormatSelectFields(arrSelectFields))
                                 + oQuery.CommandText
                                 + grdMain.OrderByClause();
            DataTable dt = oQuery.GetTable();

            vwMain             = dt.DefaultView;
            grdMain.DataSource = vwMain;
            if (!IsPostBack)
            {
                grdMain.DataBind();
            }
        }
コード例 #15
0
        protected void Page_Command(Object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save" || e.CommandName == "Charge")
            {
                ValidateEditViewFields(m_sMODULE + ".EditView");
                bool bIsValid = Page.IsValid;

                Decimal dAMOUNT = new DynamicControl(this, "AMOUNT").DecimalValue;
                if (dAMOUNT != ctlAllocationsView.ALLOCATED_TOTAL)
                {
                    ctlDynamicButtons.ErrorText =
                        Translation.GetTranslation.Term("Payments.ERR_AMOUNT_MUST_MATCH_ALLOCATION");
                    bIsValid = false;
                }
                if (bIsValid)
                {
                    string    sCUSTOM_MODULE = "PAYMENTS";
                    DataTable dtCustomFields = CRMCache.FieldsMetaData_Validated(sCUSTOM_MODULE);
                    var       oQuery         = new InlineQueryDBManager();
                    DataRow   rowCurrent     = null;
                    if (!CommonTypeConvert.IsEmptyGuid(gID))
                    {
                        string innerSql = ApplicationSQL.SQL["Payments_EditView_259"].ToString();
                        oQuery.CommandText = innerSql;
                        CRMSecurity.Filter(oQuery, m_sMODULE, "edit");
                        TypeConvert.AppendParameter(oQuery, gID, "ID", false);
                        DataTable dtCurrent = oQuery.GetTable();
                        if (dtCurrent.Rows.Count > 0)
                        {
                            rowCurrent = dtCurrent.Rows[0];
                        }
                        else
                        {
                            gID = Guid.Empty;
                        }
                    }

                    Guid     gASSIGNED_USER_ID   = new DynamicControl(this, rowCurrent, "ASSIGNED_USER_ID").ID;
                    Guid     gACCOUNT_ID         = new DynamicControl(this, rowCurrent, "ACCOUNT_ID").ID;
                    DateTime dtPAYMENT_DATE      = new DynamicControl(this, rowCurrent, "PAYMENT_DATE").DateValue;
                    string   sPAYMENT_TYPE       = new DynamicControl(this, rowCurrent, "PAYMENT_TYPE").SelectedValue;
                    string   sCUSTOMER_REFERENCE = new DynamicControl(this, rowCurrent, "CUSTOMER_REFERENCE").Text;
                    Guid     gCURRENCY_ID        = new DynamicControl(this, rowCurrent, "CURRENCY_ID").ID;
                    string   sDESCRIPTION        = new DynamicControl(this, rowCurrent, "DESCRIPTION").Text;
                    Guid     gTEAM_ID            = new DynamicControl(this, rowCurrent, "TEAM_ID").ID;
                    Guid     gCREDIT_CARD_ID     = new DynamicControl(this, rowCurrent, "CREDIT_CARD_ID").ID;
                    if (sPAYMENT_TYPE != "Credit Card")
                    {
                        gCREDIT_CARD_ID = Guid.Empty;
                    }
                    float fEXCHANGE_RATE =
                        new DynamicControl(ctlAllocationsView, rowCurrent, "EXCHANGE_RATE").FloatValue;
                    var sbINVOICE_NUMBER = new StringBuilder();
                    if (dtPAYMENT_DATE == ((DateTime)SqlDateTime.MinValue) || e.CommandName == "Charge")
                    {
                        dtPAYMENT_DATE = DateTime.Now;
                    }

                    CommonProcedure.PatmentsUpdate
                        (ref gID
                        , gASSIGNED_USER_ID
                        , gACCOUNT_ID
                        , dtPAYMENT_DATE
                        , sPAYMENT_TYPE
                        , sCUSTOMER_REFERENCE
                        , fEXCHANGE_RATE
                        , gCURRENCY_ID
                        , dAMOUNT
                        , sDESCRIPTION
                        , gTEAM_ID
                        , gCREDIT_CARD_ID
                        );
                    CRMDynamic.UpdateCustomFields(this, gID, sCUSTOM_MODULE, dtCustomFields);

                    DataTable dtLineItems = ctlAllocationsView.LineItems;
                    foreach (DataRow row in dtLineItems.Rows)
                    {
                        if (row.RowState == DataRowState.Deleted)
                        {
                            Guid gITEM_ID = CommonTypeConvert.ToGuid(row["ID", DataRowVersion.Original]);
                            if (!CommonTypeConvert.IsEmptyGuid(gITEM_ID))
                            {
                                CommonProcedure.InvoicesPAYMENTS_Delete(gITEM_ID);
                            }
                        }
                    }
                    foreach (DataRow row in dtLineItems.Rows)
                    {
                        if (row.RowState != DataRowState.Deleted)
                        {
                            Guid    gITEM_ID        = CommonTypeConvert.ToGuid(row["ID"]);
                            Guid    gINVOICE_ID     = CommonTypeConvert.ToGuid(row["INVOICE_ID"]);
                            Decimal dINVOICE_AMOUNT = CommonTypeConvert.ToDecimal(row["AMOUNT"]);
                            if (!CommonTypeConvert.IsEmptyGuid(gINVOICE_ID))
                            {
                                CommonProcedure.InvoicesPAYMENTS_Update
                                    (ref gITEM_ID
                                    , gINVOICE_ID
                                    , gID
                                    , dINVOICE_AMOUNT
                                    );
                                if (sbINVOICE_NUMBER.Length > 0)
                                {
                                    sbINVOICE_NUMBER.Append(",");
                                }
                                sbINVOICE_NUMBER.Append(gINVOICE_ID.ToString());
                            }
                        }
                    }

                    ViewState["ID"] = gID;


                    if (e.CommandName == "Charge")
                    {
                        sbINVOICE_NUMBER.Append(" " + DateTime.UtcNow);
                        //CRM.Common.Charge.CC.Charge(Application, gID, gCURRENCY_ID, gACCOUNT_ID, gCREDIT_CARD_ID, Request.UserHostAddress, sbINVOICE_NUMBER.ToString(), sDESCRIPTION, dAMOUNT);
                    }

                    Response.Redirect("view.aspx?ID=" + gID);
                }
            }
            else if (e.CommandName == "Cancel")
            {
                if (CommonTypeConvert.IsEmptyGuid(gID))
                {
                    Response.Redirect("Index.aspx");
                }
                else
                {
                    Response.Redirect("view.aspx?ID=" + gID);
                }
            }
        }
コード例 #16
0
        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 (CommonTypeConvert.IsEmptyGuid(gID))
            {
                gID = CommonTypeConvert.ToGuid(ViewState["ID"]);
            }
            if (!IsPostBack)
            {
                Guid gDuplicateID = CommonTypeConvert.ToGuid(Request["DuplicateID"]);
                if (!CommonTypeConvert.IsEmptyGuid(gID) || !CommonTypeConvert.IsEmptyGuid(gDuplicateID))
                {
                    var    oQuery   = new InlineQueryDBManager();
                    string innerSql = ApplicationSQL.SQL["Payments_EditView_259"].ToString();
                    oQuery.CommandText = innerSql;
                    CRMSecurity.Filter(oQuery, m_sMODULE, "edit");
                    if (!CommonTypeConvert.IsEmptyGuid(gDuplicateID))
                    {
                        TypeConvert.AppendParameter(oQuery, gDuplicateID, "ID", false);
                        gID = Guid.Empty;
                    }
                    else
                    {
                        TypeConvert.AppendParameter(oQuery, gID, "ID", false);
                    }
                    using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (rdr.Read())
                        {
                            ctlModuleHeader.Title = CommonTypeConvert.ToString(rdr["PAYMENT_NUM"]);
                            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);
                            ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView",
                                                            CommonTypeConvert.ToGuid(rdr["ASSIGNED_USER_ID"]), rdr);

                            var CURRENCY_ID = tblMain.FindControl("CURRENCY_ID") as DropDownList;
                            if (CURRENCY_ID != null)
                            {
                                CURRENCY_ID.AutoPostBack          = true;
                                CURRENCY_ID.SelectedIndexChanged += CURRENCY_ID_Changed;
                            }
                            var PAYMENT_TYPE = tblMain.FindControl("PAYMENT_TYPE") as DropDownList;
                            if (PAYMENT_TYPE != null)
                            {
                                PAYMENT_TYPE.AutoPostBack          = true;
                                PAYMENT_TYPE.SelectedIndexChanged += PAYMENT_TYPE_Changed;
                                PAYMENT_TYPE_Changed(null, null);
                            }
                            Guid gACCOUNT_ID = CommonTypeConvert.ToGuid(rdr["ACCOUNT_ID"]);
                            ctlAllocationsView.LoadLineItems(gID, gACCOUNT_ID, gDuplicateID, oQuery, rdr);
                        }
                        else
                        {
                            Guid gPARENT_ID = CommonTypeConvert.ToGuid(Request["PARENT_ID"]);
                            ctlAllocationsView.LoadLineItems(gID, gPARENT_ID, gDuplicateID, oQuery, null);
                            ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);
                            ctlDynamicButtons.DisableAll();
                            ctlDynamicButtons.ErrorText = Translation.GetTranslation.Term("ACL.LBL_NO_ACCESS");
                        }
                    }
                }
                else
                {
                    AppendEditViewFields(m_sMODULE + ".EditView", tblMain, null);
                    ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);

                    var CURRENCY_ID = tblMain.FindControl("CURRENCY_ID") as DropDownList;
                    if (CURRENCY_ID != null)
                    {
                        CURRENCY_ID.AutoPostBack          = true;
                        CURRENCY_ID.SelectedIndexChanged += CURRENCY_ID_Changed;
                    }
                    Guid gACCOUNT_ID = Guid.Empty;
                    Guid gPARENT_ID  = CommonTypeConvert.ToGuid(Request["PARENT_ID"]);
                    new DynamicControl(this, "PAYMENT_DATE").DateValue = DateTime.Today;
                    Guid gINVOICE_ID = gPARENT_ID;
                    if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID))
                    {
                        string sMODULE      = String.Empty;
                        string sPARENT_TYPE = String.Empty;
                        string sPARENT_NAME = String.Empty;
                        CommonProcedure.ParentGet(ref gPARENT_ID, ref sMODULE, ref sPARENT_TYPE, ref sPARENT_NAME);
                        if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID) && sMODULE == "Accounts")
                        {
                            gACCOUNT_ID = gPARENT_ID;
                            new DynamicControl(this, "ACCOUNT_ID").ID     = gPARENT_ID;
                            new DynamicControl(this, "ACCOUNT_NAME").Text = sPARENT_NAME;
                            var oQuery = new InlineQueryDBManager();
                            ctlAllocationsView.LoadLineItems(gID, gACCOUNT_ID, gDuplicateID, oQuery, null);
                        }
                        else if (!CommonTypeConvert.IsEmptyGuid(gINVOICE_ID))
                        {
                            var    oQuery   = new InlineQueryDBManager();
                            string innerSql = ApplicationSQL.SQL["Payments_EditView"].ToString();
                            oQuery.CommandText = innerSql;
                            CRMSecurity.Filter(oQuery, "Invoices", "edit");
                            TypeConvert.AppendParameter(oQuery, gINVOICE_ID, "ID", false);
                            using (SqlDataReader rdr = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                            {
                                if (rdr.Read())
                                {
                                    gACCOUNT_ID = CommonTypeConvert.ToGuid(rdr["BILLING_ACCOUNT_ID"]);
                                    new DynamicControl(this, "ACCOUNT_ID").ID =
                                        CommonTypeConvert.ToGuid(rdr["BILLING_ACCOUNT_ID"]);
                                    new DynamicControl(this, "ACCOUNT_NAME").Text =
                                        CommonTypeConvert.ToString(rdr["BILLING_ACCOUNT_NAME"]);

                                    ctlAllocationsView.LoadLineItems(gID, gACCOUNT_ID, gDuplicateID, oQuery, null);
                                    new DynamicControl(this, "AMOUNT").Text =
                                        Currency.GetCurrency.ToCurrency(
                                            CommonTypeConvert.ToDecimal(rdr["AMOUNT_DUE_USDOLLAR"])).ToString("0.00");
                                }
                            }
                        }
                    }
                    var PAYMENT_TYPE = tblMain.FindControl("PAYMENT_TYPE") as DropDownList;
                    if (PAYMENT_TYPE != null)
                    {
                        PAYMENT_TYPE.AutoPostBack          = true;
                        PAYMENT_TYPE.SelectedIndexChanged += PAYMENT_TYPE_Changed;
                        PAYMENT_TYPE_Changed(null, null);
                    }
                }
            }
            else
            {
                ctlModuleHeader.Title = CommonTypeConvert.ToString(ViewState["ctlModuleHeader.Title"]);
                SetPageTitle(Translation.GetTranslation.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
            }
        }
コード例 #17
0
        protected void Page_Command(Object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save")
            {
                ValidateEditViewFields(m_sMODULE + ".EditView");
                if (Page.IsValid)
                {
                    string    sCUSTOM_MODULE = "PRODUCT_TEMPLATES";
                    DataTable dtCustomFields = CRMCache.FieldsMetaData_Validated(sCUSTOM_MODULE);

                    var oQuery = new InlineQueryDBManager();

                    DataRow rowCurrent = null;
                    var     dtCurrent  = new DataTable();
                    if (!CommonTypeConvert.IsEmptyGuid(gID))
                    {
                        string innerSql = ApplicationSQL.SQL["Administration_ProductTemplates_EditView_39"].ToString();
                        oQuery.CommandText = innerSql;
                        CRMSecurity.Filter(oQuery, m_sMODULE, "edit");
                        TypeConvert.AppendParameter(oQuery, gID, "ID", false);
                        dtCurrent = oQuery.GetTable();
                        if (dtCurrent.Rows.Count > 0)
                        {
                            rowCurrent = dtCurrent.Rows[0];
                        }
                        else
                        {
                            gID = Guid.Empty;
                        }
                    }


                    CommonProcedure.ProductTemplatesUpdate
                        (ref gID
                        , new DynamicControl(this, rowCurrent, "NAME").Text
                        , new DynamicControl(this, rowCurrent, "STATUS").SelectedValue
                        , new DynamicControl(this, rowCurrent, "QUANTITY").IntegerValue
                        , new DynamicControl(this, rowCurrent, "DATE_AVAILABLE").DateValue
                        , new DynamicControl(this, rowCurrent, "DATE_COST_PRICE").DateValue
                        , new DynamicControl(this, rowCurrent, "ACCOUNT_ID").ID
                        , new DynamicControl(this, rowCurrent, "MANUFACTURER_ID").ID
                        , new DynamicControl(this, rowCurrent, "CATEGORY_ID").ID
                        , new DynamicControl(this, rowCurrent, "TYPE_ID").ID
                        , new DynamicControl(this, rowCurrent, "WEBSITE").Text
                        , new DynamicControl(this, rowCurrent, "MFT_PART_NUM").Text
                        , new DynamicControl(this, rowCurrent, "VENDOR_PART_NUM").Text
                        , new DynamicControl(this, rowCurrent, "TAX_CLASS").SelectedValue
                        , new DynamicControl(this, rowCurrent, "WEIGHT").FloatValue
                        , new DynamicControl(this, rowCurrent, "CURRENCY_ID").ID
                        , new DynamicControl(this, rowCurrent, "COST_PRICE").DecimalValue
                        , new DynamicControl(this, rowCurrent, "LIST_PRICE").DecimalValue
                        , new DynamicControl(this, rowCurrent, "DISCOUNT_PRICE").DecimalValue
                        , new DynamicControl(this, rowCurrent, "PRICING_FACTOR").IntegerValue
                        , new DynamicControl(this, rowCurrent, "PRICING_FORMULA").SelectedValue
                        , new DynamicControl(this, rowCurrent, "SUPPORT_NAME").Text
                        , new DynamicControl(this, rowCurrent, "SUPPORT_CONTACT").Text
                        , new DynamicControl(this, rowCurrent, "SUPPORT_DESCRIPTION").Text
                        , new DynamicControl(this, rowCurrent, "SUPPORT_TERM").SelectedValue
                        , new DynamicControl(this, rowCurrent, "DESCRIPTION").Text
                        );
                    CRMDynamic.UpdateCustomFields(this, gID, sCUSTOM_MODULE, dtCustomFields);
                    Response.Redirect("view.aspx?ID=" + gID);
                }
            }
            else if (e.CommandName == "Cancel")
            {
                if (CommonTypeConvert.IsEmptyGuid(gID))
                {
                    Response.Redirect("Index.aspx");
                }
                else
                {
                    Response.Redirect("view.aspx?ID=" + gID);
                }
            }
        }
コード例 #18
0
        public void LoadLineItems(Guid gID, Guid gACCOUNT_ID, Guid gDuplicateID, InlineQueryDBManager oQuery,
                                  SqlDataReader rdr)
        {
            this.gACCOUNT_ID = gACCOUNT_ID;
            if (!IsPostBack)
            {
                GetCurrencyControl();
                CURRENCY_ID.SelectedValue = Currency.GetCurrency.ID.ToString();
                EXCHANGE_RATE.Value       = Currency.GetCurrency.CONVERSION_RATE.ToString();
                foreach (DataControlField col in grdMain.Columns)
                {
                    if (!CommonTypeConvert.IsEmptyString(col.HeaderText))
                    {
                        col.HeaderText = Translation.GetTranslation.Term(col.HeaderText);
                    }
                    var cf = col as CommandField;
                    if (cf != null)
                    {
                        cf.EditText   = Translation.GetTranslation.Term(cf.EditText);
                        cf.DeleteText = Translation.GetTranslation.Term(cf.DeleteText);
                        cf.UpdateText = Translation.GetTranslation.Term(cf.UpdateText);
                        cf.CancelText = Translation.GetTranslation.Term(cf.CancelText);
                    }
                }

                if ((!CommonTypeConvert.IsEmptyGuid(gID) || !CommonTypeConvert.IsEmptyGuid(gDuplicateID)) &&
                    (oQuery != null) && (rdr != null))
                {
                    CURRENCY_ID.SelectedValue = CommonTypeConvert.ToString(rdr["CURRENCY_ID"]);
                    EXCHANGE_RATE.Value       = Currency.GetCurrency.CONVERSION_RATE.ToString();
                    float fEXCHANGE_RATE = CommonTypeConvert.ToFloat(rdr["EXCHANGE_RATE"]);
                    if (fEXCHANGE_RATE == 0.0f)
                    {
                        fEXCHANGE_RATE = 1.0f;
                    }
                    EXCHANGE_RATE.Value = fEXCHANGE_RATE.ToString();
                    if (CURRENCY_ID.Items.Count > 0)
                    {
                        Guid gCURRENCY_ID = CommonTypeConvert.ToGuid(CURRENCY_ID.SelectedValue);
                        SetCurrency(gCURRENCY_ID, fEXCHANGE_RATE);
                        EXCHANGE_RATE.Value = Currency.GetCurrency.CONVERSION_RATE.ToString();
                    }
                    ALLOCATED.Text =
                        Currency.GetCurrency.ToCurrency(CommonTypeConvert.ToDecimal(rdr["TOTAL_ALLOCATED_USDOLLAR"])).
                        ToString("c");
                    ALLOCATED_USDOLLAR.Value =
                        CommonTypeConvert.ToDecimal(rdr["TOTAL_ALLOCATED_USDOLLAR"]).ToString("0.00");
                    rdr.Close();
                    string innerSql = ApplicationSQL.SQL["Payments_AllocationsView_233"].ToString();

                    oQuery.CommandText = innerSql;
                    TypeConvert.AppendParameter(oQuery, gID, "PAYMENT_ID", false);
                    oQuery.CommandText += " order by DATE_MODIFIED asc" + ControlChars.CrLf;
                    DataTable dtLineItems = oQuery.GetTable();
                    if (!CommonTypeConvert.IsEmptyGuid(gDuplicateID))
                    {
                        foreach (DataRow row in dtLineItems.Rows)
                        {
                            row["ID"] = Guid.NewGuid();
                        }
                    }
                    DataRow rowNew = dtLineItems.NewRow();
                    dtLineItems.Rows.Add(rowNew);

                    ViewState["LineItems"] = dtLineItems;
                    grdMain.DataSource     = dtLineItems;
                    grdMain.EditIndex      = dtLineItems.Rows.Count - 1;
                    grdMain.DataBind();
                }
                else
                {
                    dtLineItems = new DataTable();
                    var colID                  = new DataColumn("ID", Type.GetType("System.Guid"));
                    var colINVOICE_NAME        = new DataColumn("INVOICE_NAME", Type.GetType("System.String"));
                    var colINVOICE_ID          = new DataColumn("INVOICE_ID", Type.GetType("System.Guid"));
                    var colAMOUNT_DUE          = new DataColumn("AMOUNT_DUE", Type.GetType("System.Decimal"));
                    var colAMOUNT_DUE_USDOLLAR = new DataColumn("AMOUNT_DUE_USDOLLAR", Type.GetType("System.Decimal"));
                    var colAMOUNT              = new DataColumn("AMOUNT", Type.GetType("System.Decimal"));
                    var colAMOUNT_USDOLLAR     = new DataColumn("AMOUNT_USDOLLAR", Type.GetType("System.Decimal"));
                    dtLineItems.Columns.Add(colID);
                    dtLineItems.Columns.Add(colINVOICE_NAME);
                    dtLineItems.Columns.Add(colINVOICE_ID);
                    dtLineItems.Columns.Add(colAMOUNT_DUE);
                    dtLineItems.Columns.Add(colAMOUNT_DUE_USDOLLAR);
                    dtLineItems.Columns.Add(colAMOUNT);
                    dtLineItems.Columns.Add(colAMOUNT_USDOLLAR);
                    DataRow rowNew   = null;
                    string  innerSql = ApplicationSQL.SQL["Payments_AllocationsView"].ToString();

                    oQuery.CommandText = innerSql;
                    Guid gPARENT_ID = CommonTypeConvert.ToGuid(Request["PARENT_ID"]);
                    TypeConvert.AppendParameter(oQuery, gPARENT_ID, "ID", false);
                    using (SqlDataReader rdrInvoice = oQuery.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (rdrInvoice.Read())
                        {
                            rowNew = dtLineItems.NewRow();
                            rowNew["INVOICE_NAME"]        = CommonTypeConvert.ToString(rdrInvoice["NAME"]);
                            rowNew["INVOICE_ID"]          = CommonTypeConvert.ToGuid(rdrInvoice["ID"]);
                            rowNew["AMOUNT_DUE"]          = CommonTypeConvert.ToDecimal(rdrInvoice["AMOUNT_DUE"]);
                            rowNew["AMOUNT_DUE_USDOLLAR"] =
                                CommonTypeConvert.ToDecimal(rdrInvoice["AMOUNT_DUE_USDOLLAR"]);
                            rowNew["AMOUNT"]          = CommonTypeConvert.ToDecimal(rdrInvoice["AMOUNT_DUE"]);
                            rowNew["AMOUNT_USDOLLAR"] = CommonTypeConvert.ToDecimal(rdrInvoice["AMOUNT_DUE_USDOLLAR"]);
                            if (rdrInvoice["AMOUNT_DUE"] == DBNull.Value)
                            {
                                rowNew["AMOUNT_DUE"]          = CommonTypeConvert.ToDecimal(rdrInvoice["TOTAL"]);
                                rowNew["AMOUNT_DUE_USDOLLAR"] = CommonTypeConvert.ToDecimal(rdrInvoice["TOTAL_USDOLLAR"]);
                                rowNew["AMOUNT"]          = CommonTypeConvert.ToDecimal(rdrInvoice["TOTAL"]);
                                rowNew["AMOUNT_USDOLLAR"] = CommonTypeConvert.ToDecimal(rdrInvoice["TOTAL_USDOLLAR"]);
                            }
                            dtLineItems.Rows.Add(rowNew);
                        }
                    }
                    rowNew = dtLineItems.NewRow();
                    dtLineItems.Rows.Add(rowNew);

                    ViewState["LineItems"] = dtLineItems;
                    grdMain.DataSource     = dtLineItems;
                    grdMain.EditIndex      = dtLineItems.Rows.Count - 1;
                    grdMain.DataBind();

                    UpdateTotals();
                }
            }
        }
コード例 #19
0
        protected void Page_Command(Object sender, CommandEventArgs e)
        {
            Guid   gORDER_ID    = CommonTypeConvert.ToGuid(Request["ORDER_ID"]);
            Guid   gQUOTE_ID    = CommonTypeConvert.ToGuid(Request["QUOTE_ID"]);
            Guid   gPARENT_ID   = CommonTypeConvert.ToGuid(Request["PARENT_ID"]);
            string sMODULE      = String.Empty;
            string sPARENT_TYPE = String.Empty;
            string sPARENT_NAME = String.Empty;

            CommonProcedure.ParentGet(ref gPARENT_ID, ref sMODULE, ref sPARENT_TYPE, ref sPARENT_NAME);
            if (e.CommandName == "Save")
            {
                ValidateEditViewFields(m_sMODULE + ".EditView");
                ValidateEditViewFields(m_sMODULE + ".EditAddress");
                ValidateEditViewFields(m_sMODULE + ".EditDescription");
                if (Page.IsValid)
                {
                    string    sCUSTOM_MODULE    = "INVOICES";
                    DataTable dtCustomFields    = CRMCache.FieldsMetaData_Validated(sCUSTOM_MODULE);
                    DataTable dtCustomLineItems =
                        CRMCache.FieldsMetaData_UnvalidatedCustomFields(sCUSTOM_MODULE + "_LINE_ITEMS");

                    DataRow rowCurrent = null;
                    var     dtCurrent  = new DataTable();
                    if (!CommonTypeConvert.IsEmptyGuid(gID))
                    {
                        string innerSql = ApplicationSQL.SQL["Invoices_EditView_323"].ToString();
                        var    oQuery   = new InlineQueryDBManager();

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

                        if (dtCurrent.Rows.Count > 0)
                        {
                            rowCurrent = dtCurrent.Rows[0];
                        }
                        else
                        {
                            gID = Guid.Empty;
                        }
                    }


                    ctlEditLineItemsView.UpdateTotals();
                    CommonProcedure.InvoicesUpdate
                        (ref gID
                        , new DynamicControl(this, rowCurrent, "ASSIGNED_USER_ID").ID
                        , new DynamicControl(this, rowCurrent, "NAME").Text
                        , new DynamicControl(this, rowCurrent, "QUOTE_ID").ID
                        , new DynamicControl(this, rowCurrent, "ORDER_ID").ID
                        , new DynamicControl(this, rowCurrent, "OPPORTUNITY_ID").ID
                        , new DynamicControl(this, rowCurrent, "PAYMENT_TERMS").SelectedValue
                        , new DynamicControl(this, rowCurrent, "INVOICE_STAGE").SelectedValue
                        , new DynamicControl(this, rowCurrent, "PURCHASE_ORDER_NUM").Text
                        , new DynamicControl(this, rowCurrent, "DUE_DATE").DateValue
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "EXCHANGE_RATE").FloatValue
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "CURRENCY_ID").ID
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "TAXRATE_ID").ID
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "SHIPPER_ID").ID
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "SUBTOTAL").DecimalValue
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "DISCOUNT").DecimalValue
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "SHIPPING").DecimalValue
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "TAX").DecimalValue
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "TOTAL").DecimalValue
                        , new DynamicControl(ctlEditLineItemsView, rowCurrent, "AMOUNT_DUE").DecimalValue
                        , new DynamicControl(this, rowCurrent, "BILLING_ACCOUNT_ID").ID
                        , new DynamicControl(this, rowCurrent, "BILLING_CONTACT_ID").ID
                        , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_STREET").Text
                        , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_CITY").Text
                        , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_STATE").Text
                        , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_POSTALCODE").Text
                        , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_COUNTRY").Text
                        , new DynamicControl(this, rowCurrent, "SHIPPING_ACCOUNT_ID").ID
                        , new DynamicControl(this, rowCurrent, "SHIPPING_CONTACT_ID").ID
                        , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_STREET").Text
                        , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_CITY").Text
                        , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_STATE").Text
                        , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_POSTALCODE").Text
                        , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_COUNTRY").Text
                        , new DynamicControl(this, rowCurrent, "DESCRIPTION").Text
                        , new DynamicControl(this, rowCurrent, "TEAM_ID").ID
                        );
                    CRMDynamic.UpdateCustomFields(this, gID, sCUSTOM_MODULE, dtCustomFields);

                    DataTable dtLineItems = ctlEditLineItemsView.LineItems;
                    foreach (DataRow row in dtLineItems.Rows)
                    {
                        if (row.RowState == DataRowState.Deleted)
                        {
                            Guid gITEM_ID = CommonTypeConvert.ToGuid(row["ID", DataRowVersion.Original]);
                            if (!CommonTypeConvert.IsEmptyGuid(gITEM_ID))
                            {
                                CommonProcedure.InvoicesLINE_ITEMS_Delete(gITEM_ID);
                            }
                        }
                    }
                    int nPOSITION = 1;
                    foreach (DataRow row in dtLineItems.Rows)
                    {
                        if (row.RowState != DataRowState.Deleted)
                        {
                            Guid    gITEM_ID             = CommonTypeConvert.ToGuid(row["ID"]);
                            Guid    gLINE_GROUP_ID       = CommonTypeConvert.ToGuid(row["LINE_GROUP_ID"]);
                            string  sLINE_ITEM_TYPE      = CommonTypeConvert.ToString(row["LINE_ITEM_TYPE"]);
                            string  sNAME                = CommonTypeConvert.ToString(row["NAME"]);
                            string  sMFT_PART_NUM        = CommonTypeConvert.ToString(row["MFT_PART_NUM"]);
                            string  sVENDOR_PART_NUM     = CommonTypeConvert.ToString(row["VENDOR_PART_NUM"]);
                            Guid    gPRODUCT_TEMPLATE_ID = CommonTypeConvert.ToGuid(row["PRODUCT_TEMPLATE_ID"]);
                            string  sTAX_CLASS           = CommonTypeConvert.ToString(row["TAX_CLASS"]);
                            int     nQUANTITY            = CommonTypeConvert.ToInteger(row["QUANTITY"]);
                            Decimal dCOST_PRICE          = CommonTypeConvert.ToDecimal(row["COST_PRICE"]);
                            Decimal dLIST_PRICE          = CommonTypeConvert.ToDecimal(row["LIST_PRICE"]);
                            Decimal dUNIT_PRICE          = CommonTypeConvert.ToDecimal(row["UNIT_PRICE"]);
                            string  sDESCRIPTION         = CommonTypeConvert.ToString(row["DESCRIPTION"]);
                            if (!CommonTypeConvert.IsEmptyGuid(gPRODUCT_TEMPLATE_ID) ||
                                !CommonTypeConvert.IsEmptyString(sNAME))
                            {
                                CommonProcedure.InvoicesLINE_ITEMS_Update
                                    (ref gITEM_ID
                                    , gID
                                    , gLINE_GROUP_ID
                                    , sLINE_ITEM_TYPE
                                    , nPOSITION
                                    , sNAME
                                    , sMFT_PART_NUM
                                    , sVENDOR_PART_NUM
                                    , gPRODUCT_TEMPLATE_ID
                                    , sTAX_CLASS
                                    , nQUANTITY
                                    , dCOST_PRICE
                                    , dLIST_PRICE
                                    , dUNIT_PRICE
                                    , sDESCRIPTION
                                    );
                                CRMDynamic.UpdateCustomFields(row, gITEM_ID, sCUSTOM_MODULE + "_LINE_ITEMS",
                                                              dtCustomLineItems);
                                nPOSITION++;
                            }
                        }
                    }
                    CommonProcedure.InvoicesUpdateAmountDue(gID);


                    if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID))
                    {
                        Response.Redirect("~/CRM/" + sMODULE + "/view.aspx?ID=" + gPARENT_ID);
                    }
                    else
                    {
                        Response.Redirect("view.aspx?ID=" + gID);
                    }
                }
            }
            else if (e.CommandName == "Cancel")
            {
                if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID))
                {
                    Response.Redirect("~/CRM/" + sMODULE + "/view.aspx?ID=" + gPARENT_ID);
                }
                else if (!CommonTypeConvert.IsEmptyGuid(gORDER_ID))
                {
                    Response.Redirect("~/CRM/Orders/view.aspx?ID=" + gORDER_ID);
                }
                else if (!CommonTypeConvert.IsEmptyGuid(gQUOTE_ID))
                {
                    Response.Redirect("~/CRM/Quotes/view.aspx?ID=" + gQUOTE_ID);
                }
                else if (CommonTypeConvert.IsEmptyGuid(gID))
                {
                    Response.Redirect("Index.aspx");
                }
                else
                {
                    Response.Redirect("view.aspx?ID=" + gID);
                }
            }
        }
コード例 #20
0
        protected void Page_Command(Object sender, CommandEventArgs e)
        {
            Guid   gPARENT_ID   = CommonTypeConvert.ToGuid(Request["PARENT_ID"]);
            string sMODULE      = String.Empty;
            string sPARENT_TYPE = String.Empty;
            string sPARENT_NAME = String.Empty;

            CommonProcedure.ParentGet(ref gPARENT_ID, ref sMODULE, ref sPARENT_TYPE, ref sPARENT_NAME);
            if (e.CommandName == "Save")
            {
                var txtNAME = FindControl("NAME") as TextBox;
                var txtPRODUCT_TEMPLATE_ID = FindControl("PRODUCT_TEMPLATE_ID") as HtmlInputHidden;
                if (CommonTypeConvert.IsEmptyString(txtNAME.Text.Trim()))
                {
                    txtPRODUCT_TEMPLATE_ID.Value = String.Empty;
                }
                else if (CommonTypeConvert.IsEmptyString(txtPRODUCT_TEMPLATE_ID.Value))
                {
                    txtPRODUCT_TEMPLATE_ID.Value = Guid.Empty.ToString();
                }

                ValidateEditViewFields(m_sMODULE + ".EditView");
                ValidateEditViewFields(m_sMODULE + ".CostView");
                ValidateEditViewFields(m_sMODULE + ".MftView");
                if (Page.IsValid)
                {
                    string    sCUSTOM_MODULE = "PRODUCTS";
                    DataTable dtCustomFields = CRMCache.FieldsMetaData_Validated(sCUSTOM_MODULE);
                    var       oQuery         = new InlineQueryDBManager();
                    DataRow   rowCurrent     = null;
                    if (!CommonTypeConvert.IsEmptyGuid(gID))
                    {
                        string innerSql = ApplicationSQL.SQL["Products_EditView"].ToString();
                        oQuery.CommandText = innerSql;
                        CRMSecurity.Filter(oQuery, m_sMODULE, "edit");
                        TypeConvert.AppendParameter(oQuery, gID, "ID", false);
                        DataTable dtCurrent = oQuery.GetTable();
                        if (dtCurrent.Rows.Count > 0)
                        {
                            rowCurrent = dtCurrent.Rows[0];
                        }
                        else
                        {
                            gID = Guid.Empty;
                        }
                    }

                    CommonProcedure.ProductUpdate
                        (ref gID
                        , new DynamicControl(this, rowCurrent, "PRODUCT_TEMPLATE_ID").ID
                        , new DynamicControl(this, rowCurrent, "NAME").Text
                        , new DynamicControl(this, rowCurrent, "STATUS").SelectedValue
                        , new DynamicControl(this, rowCurrent, "ACCOUNT_ID").ID
                        , new DynamicControl(this, rowCurrent, "CONTACT_ID").ID
                        , new DynamicControl(this, rowCurrent, "QUANTITY").IntegerValue
                        , new DynamicControl(this, rowCurrent, "DATE_PURCHASED").DateValue
                        , new DynamicControl(this, rowCurrent, "DATE_SUPPORT_EXPIRES").DateValue
                        , new DynamicControl(this, rowCurrent, "DATE_SUPPORT_STARTS").DateValue
                        , new DynamicControl(this, rowCurrent, "MANUFACTURER_ID").ID
                        , new DynamicControl(this, rowCurrent, "CATEGORY_ID").ID
                        , new DynamicControl(this, rowCurrent, "TYPE_ID").ID
                        , new DynamicControl(this, rowCurrent, "WEBSITE").Text
                        , new DynamicControl(this, rowCurrent, "MFT_PART_NUM").Text
                        , new DynamicControl(this, rowCurrent, "VENDOR_PART_NUM").Text
                        , new DynamicControl(this, rowCurrent, "SERIAL_NUMBER").Text
                        , new DynamicControl(this, rowCurrent, "ASSET_NUMBER").Text
                        , new DynamicControl(this, rowCurrent, "TAX_CLASS").SelectedValue
                        , new DynamicControl(this, rowCurrent, "WEIGHT").FloatValue
                        , new DynamicControl(this, rowCurrent, "CURRENCY_ID").ID
                        , new DynamicControl(this, rowCurrent, "COST_PRICE").DecimalValue
                        , new DynamicControl(this, rowCurrent, "LIST_PRICE").DecimalValue
                        , new DynamicControl(this, rowCurrent, "BOOK_VALUE").DecimalValue
                        , new DynamicControl(this, rowCurrent, "BOOK_VALUE_DATE").DateValue
                        , new DynamicControl(this, rowCurrent, "DISCOUNT_PRICE").DecimalValue
                        , new DynamicControl(this, rowCurrent, "PRICING_FACTOR").IntegerValue
                        , new DynamicControl(this, rowCurrent, "PRICING_FORMULA").SelectedValue
                        , new DynamicControl(this, rowCurrent, "SUPPORT_NAME").Text
                        , new DynamicControl(this, rowCurrent, "SUPPORT_CONTACT").Text
                        , new DynamicControl(this, rowCurrent, "SUPPORT_DESCRIPTION").Text
                        , new DynamicControl(this, rowCurrent, "SUPPORT_TERM").SelectedValue
                        , new DynamicControl(this, rowCurrent, "DESCRIPTION").Text
                        , new DynamicControl(this, rowCurrent, "TEAM_ID").ID
                        );
                    CRMDynamic.UpdateCustomFields(this, gID, sCUSTOM_MODULE, dtCustomFields);

                    if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID))
                    {
                        Response.Redirect("~/CRM/" + sMODULE + "/view.aspx?ID=" + gPARENT_ID);
                    }
                    else
                    {
                        Response.Redirect("view.aspx?ID=" + gID);
                    }
                }
            }
            else if (e.CommandName == "Cancel")
            {
                if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID))
                {
                    Response.Redirect("~/CRM/" + sMODULE + "/view.aspx?ID=" + gPARENT_ID);
                }
                else if (CommonTypeConvert.IsEmptyGuid(gID))
                {
                    Response.Redirect("Index.aspx");
                }
                else
                {
                    Response.Redirect("view.aspx?ID=" + gID);
                }
            }
        }
コード例 #21
0
        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)
            {
                Guid gDuplicateID = CommonTypeConvert.ToGuid(Request["DuplicateID"]);
                if (!CommonTypeConvert.IsEmptyGuid(gID) || !CommonTypeConvert.IsEmptyGuid(gDuplicateID))
                {
                    var    oQuery   = new InlineQueryDBManager();
                    string innerSql = ApplicationSQL.SQL["Products_EditView"].ToString();
                    oQuery.CommandText = innerSql;
                    CRMSecurity.Filter(oQuery, m_sMODULE, "edit");
                    if (!CommonTypeConvert.IsEmptyGuid(gDuplicateID))
                    {
                        TypeConvert.AppendParameter(oQuery, gDuplicateID, "ID", false);
                        gID = Guid.Empty;
                    }
                    else
                    {
                        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);
                            ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;

                            AppendEditViewFields(m_sMODULE + ".EditView", tblMain, rdr);
                            AppendEditViewFields(m_sMODULE + ".CostView", tblCost, rdr);
                            AppendEditViewFields(m_sMODULE + ".MftView", tblManufacturer, rdr);
                            ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView",
                                                            CommonTypeConvert.ToGuid(rdr["ASSIGNED_USER_ID"]), rdr);
                            var txtNAME = FindControl("NAME") as TextBox;
                            if (txtNAME != null)
                            {
                                txtNAME.ReadOnly = false;
                            }
                        }
                        else
                        {
                            ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);
                            ctlDynamicButtons.DisableAll();
                            ctlDynamicButtons.ErrorText = Translation.GetTranslation.Term("ACL.LBL_NO_ACCESS");
                        }
                    }
                }
                else
                {
                    AppendEditViewFields(m_sMODULE + ".EditView", tblMain, null);
                    AppendEditViewFields(m_sMODULE + ".CostView", tblCost, null);
                    AppendEditViewFields(m_sMODULE + ".MftView", tblManufacturer, null);
                    ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);
                    var txtNAME = FindControl("NAME") as TextBox;
                    if (txtNAME != null)
                    {
                        txtNAME.ReadOnly = false;
                    }
                    Guid gPARENT_ID = CommonTypeConvert.ToGuid(Request["PARENT_ID"]);
                    if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID))
                    {
                        string sMODULE      = String.Empty;
                        string sPARENT_TYPE = String.Empty;
                        string sPARENT_NAME = String.Empty;
                        CommonProcedure.ParentGet(ref gPARENT_ID, ref sMODULE, ref sPARENT_TYPE, ref sPARENT_NAME);
                        if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID) && sMODULE == "Accounts")
                        {
                            new DynamicControl(this, "ACCOUNT_ID").ID     = gPARENT_ID;
                            new DynamicControl(this, "ACCOUNT_NAME").Text = sPARENT_NAME;
                        }
                        else if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID) && sMODULE == "Contacts")
                        {
                            new DynamicControl(this, "CONTACT_ID").ID     = gPARENT_ID;
                            new DynamicControl(this, "CONTACT_NAME").Text = sPARENT_NAME;
                        }
                    }
                }
            }
            else
            {
                ctlModuleHeader.Title = CommonTypeConvert.ToString(ViewState["ctlModuleHeader.Title"]);
                SetPageTitle(Translation.GetTranslation.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
            }
        }
コード例 #22
0
        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)
            {
                string sLOAD_MODULE     = "Invoices";
                string sLOAD_MODULE_KEY = "INVOICE_ID";
                Guid   gQUOTE_ID        = CommonTypeConvert.ToGuid(Request["QUOTE_ID"]);
                Guid   gORDER_ID        = CommonTypeConvert.ToGuid(Request["ORDER_ID"]);
                Guid   gDuplicateID     = CommonTypeConvert.ToGuid(Request["DuplicateID"]);
                if (!CommonTypeConvert.IsEmptyGuid(gID) || !CommonTypeConvert.IsEmptyGuid(gDuplicateID) ||
                    !CommonTypeConvert.IsEmptyGuid(gQUOTE_ID) || !CommonTypeConvert.IsEmptyGuid(gORDER_ID))
                {
                    string innerSql = ApplicationSQL.SQL["Invoices_EditView_323"].ToString();
                    var    oQuery   = new InlineQueryDBManager();

                    oQuery.CommandText = innerSql;
                    if (!CommonTypeConvert.IsEmptyGuid(gQUOTE_ID))
                    {
                        //Load the data from the QUOTES record.
                        sLOAD_MODULE       = "Quotes";
                        sLOAD_MODULE_KEY   = "QUOTE_ID";
                        innerSql           = ApplicationSQL.SQL["Invoices_EditView_333"].ToString();
                        oQuery.CommandText = innerSql;
                        //Filter by the module we are loading.
                        CRMSecurity.Filter(oQuery, sLOAD_MODULE, "edit");
                        TypeConvert.AppendParameter(oQuery, gQUOTE_ID, "ID", false);
                    }
                    else if (!CommonTypeConvert.IsEmptyGuid(gORDER_ID))
                    {
                        //  Load the data from the ORDERS record.
                        sLOAD_MODULE       = "Orders";
                        sLOAD_MODULE_KEY   = "ORDER_ID";
                        innerSql           = ApplicationSQL.SQL["Invoices_EditView"].ToString();
                        oQuery.CommandText = innerSql;
                        //Filter by the module we are loading.
                        CRMSecurity.Filter(oQuery, sLOAD_MODULE, "edit");
                        TypeConvert.AppendParameter(oQuery, gORDER_ID, "ID", false);
                    }
                    else
                    {
                        //Use new CRMSecurity.Filter() function to apply Team and ACL security rules.
                        CRMSecurity.Filter(oQuery, m_sMODULE, "edit");
                        if (!CommonTypeConvert.IsEmptyGuid(gDuplicateID))
                        {
                            TypeConvert.AppendParameter(oQuery, gDuplicateID, "ID", false);
                            gID = Guid.Empty;
                        }
                        else
                        {
                            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);
                            ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;
                            ViewState["BILLING_ACCOUNT_ID"]    = CommonTypeConvert.ToGuid(rdr["BILLING_ACCOUNT_ID"]);
                            ViewState["SHIPPING_ACCOUNT_ID"]   = CommonTypeConvert.ToGuid(rdr["SHIPPING_ACCOUNT_ID"]);

                            new DynamicControl(this, "QUOTE_ID").ID = CommonTypeConvert.ToGuid(rdr["QUOTE_ID"]);
                            new DynamicControl(this, "ORDER_ID").ID = CommonTypeConvert.ToGuid(rdr["ORDER_ID"]);

                            AppendEditViewFields(m_sMODULE + ".EditView", tblMain, rdr);
                            AppendEditViewFields(m_sMODULE + ".EditAddress", tblAddress, rdr);
                            AppendEditViewFields(m_sMODULE + ".EditDescription", tblDescription, rdr);
                            //Dynamic buttons need to be recreated in order for events to fire.
                            ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView",
                                                            CommonTypeConvert.ToGuid(rdr["ASSIGNED_USER_ID"]), rdr);

                            if (!CommonTypeConvert.IsEmptyGuid(gQUOTE_ID))
                            {
                                new DynamicControl(this, "QUOTE_ID").ID     = gQUOTE_ID;
                                new DynamicControl(this, "QUOTE_NAME").Text = CommonTypeConvert.ToString(rdr["NAME"]);
                                ctlEditLineItemsView.LoadLineItems(gQUOTE_ID, Guid.Empty, rdr, sLOAD_MODULE,
                                                                   sLOAD_MODULE_KEY);
                            }
                            else if (!CommonTypeConvert.IsEmptyGuid(gORDER_ID))
                            {
                                new DynamicControl(this, "ORDER_ID").ID     = gORDER_ID;
                                new DynamicControl(this, "ORDER_NAME").Text = CommonTypeConvert.ToString(rdr["NAME"]);
                                ctlEditLineItemsView.LoadLineItems(gORDER_ID, Guid.Empty, rdr, sLOAD_MODULE,
                                                                   sLOAD_MODULE_KEY);
                            }
                            else
                            {
                                ctlEditLineItemsView.LoadLineItems(gID, gDuplicateID, rdr, sLOAD_MODULE,
                                                                   sLOAD_MODULE_KEY);
                            }
                        }
                        else
                        {
                            ctlEditLineItemsView.LoadLineItems(gID, gDuplicateID, null, String.Empty, String.Empty);

                            //If item is not visible, then don't allow save
                            //Dynamic buttons need to be recreated in order for events to fire.
                            ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);
                            ctlDynamicButtons.DisableAll();
                            ctlDynamicButtons.ErrorText = Translation.GetTranslation.Term("ACL.LBL_NO_ACCESS");
                        }
                    }
                }
                else
                {
                    AppendEditViewFields(m_sMODULE + ".EditView", tblMain, null);
                    AppendEditViewFields(m_sMODULE + ".EditAddress", tblAddress, null);
                    AppendEditViewFields(m_sMODULE + ".EditDescription", tblDescription, null);
                    //Dynamic buttons need to be recreated in order for events to fire.
                    ctlDynamicButtons.AppendButtons(m_sMODULE + ".EditView", Guid.Empty, null);

                    //Prepopulate the Account.
                    Guid gPARENT_ID = CommonTypeConvert.ToGuid(Request["PARENT_ID"]);
                    if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID))
                    {
                        string sMODULE      = String.Empty;
                        string sPARENT_TYPE = String.Empty;
                        string sPARENT_NAME = String.Empty;
                        CommonProcedure.ParentGet(ref gPARENT_ID, ref sMODULE, ref sPARENT_TYPE, ref sPARENT_NAME);
                        if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID) && sMODULE == "Accounts")
                        {
                            UpdateAccount(gPARENT_ID, true, true);
                        }
                        if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID) && sMODULE == "Contacts")
                        {
                            UpdateContact(gPARENT_ID, true, true);
                        }
                        else if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID) && sMODULE == "Opportunities")
                        {
                            new DynamicControl(this, "OPPORTUNITY_ID").ID     = gPARENT_ID;
                            new DynamicControl(this, "OPPORTUNITY_NAME").Text = sPARENT_NAME;
                        }
                    }
                    ctlEditLineItemsView.LoadLineItems(gID, gDuplicateID, new InlineQueryDBManager(), null, String.Empty,
                                                       String.Empty);
                }
            }
            else
            {
                // When validation fails, the header title does not retain its value.  Update manually.
                ctlModuleHeader.Title = CommonTypeConvert.ToString(ViewState["ctlModuleHeader.Title"]);
                SetPageTitle(Translation.GetTranslation.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);

                var ctlBILLING_ACCOUNT_ID  = new DynamicControl(this, "BILLING_ACCOUNT_ID");
                var ctlSHIPPING_ACCOUNT_ID = new DynamicControl(this, "SHIPPING_ACCOUNT_ID");
                if (CommonTypeConvert.ToGuid(ViewState["BILLING_ACCOUNT_ID"]) != ctlBILLING_ACCOUNT_ID.ID)
                {
                    UpdateAccount(ctlBILLING_ACCOUNT_ID.ID, true, true);
                    ViewState["BILLING_ACCOUNT_ID"]  = ctlBILLING_ACCOUNT_ID.ID;
                    ViewState["SHIPPING_ACCOUNT_ID"] = ctlBILLING_ACCOUNT_ID.ID;
                }
                if (CommonTypeConvert.ToGuid(ViewState["SHIPPING_ACCOUNT_ID"]) != ctlSHIPPING_ACCOUNT_ID.ID)
                {
                    UpdateAccount(ctlSHIPPING_ACCOUNT_ID.ID, false, true);
                    ViewState["SHIPPING_ACCOUNT_ID"] = ctlSHIPPING_ACCOUNT_ID.ID;
                }
            }
        }
コード例 #23
0
 public override void SqlSearchClause(InlineQueryDBManager oQuery)
 {
     TypeConvert.AppendParameter(oQuery, txtNAME.Text, 50, CommonTypeConvert.SqlFilterMode.StartsWith, "NAME");
 }