Exemplo n.º 1
0
 /// <summary>
 /// DeleteDirectForEditView
 /// </summary>
 /// <param name="viewId">viewId</param>
 /// <param name="companyId">companyId</param>
 /// <param name="fmType">fmType</param>
 /// <param name="conditionId">conditionId</param>
 /// <param name="refId">refId</param>
 public void DeleteDirectForEditView(int viewId, int companyId, string fmType, int conditionId, int refId)
 {
     FmViewConditionGateway fmViewConditionGateway = new FmViewConditionGateway(null);
     fmViewConditionGateway.DeleteForEditView(viewId, companyId, fmType, conditionId, refId);
 }
Exemplo n.º 2
0
 /// <summary>
 /// InsertDirect
 /// </summary>
 /// <param name="viewId">viewId</param>
 /// <param name="companyId">companyId</param>
 /// <param name="fmType">fmType</param>
 /// <param name="conditionId">conditionId</param>
 /// <param name="refId">refId</param>
 /// <param name="operator_">operator_</param>
 /// <param name="conditionNumber">conditionNumber</param>
 /// <param name="value">value</param>
 /// <param name="deleted">deleted</param>
 public void InsertDirect(int viewId, int companyId, string fmType, int conditionId, int refId, string operator_, int conditionNumber, string value, bool deleted)
 {
     FmViewConditionGateway fmViewConditionGateway = new FmViewConditionGateway(null);
     fmViewConditionGateway.Insert(viewId, companyId, fmType, conditionId, refId, operator_, conditionNumber, value, deleted);
 }
Exemplo n.º 3
0
 /// <summary>
 /// DeleteDirect
 /// </summary>
 /// <param name="viewId">viewId</param>
 /// <param name="companyId">companyId</param>
 public void DeleteDirect(int viewId, int companyId)
 {
     FmViewConditionGateway fmViewConditionGateway = new FmViewConditionGateway(null);
     fmViewConditionGateway.Delete(viewId, companyId);
 }
Exemplo n.º 4
0
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS
 //
 /// <summary>
 /// UpdateDirect
 /// </summary>
 /// <param name="originalViewId">originalViewId</param>
 /// <param name="originalFmType">originalFmType</param>
 /// <param name="originalCompanyId">originalCompanyId</param>
 /// <param name="originalConditionId">originalConditionId</param>
 /// <param name="originalRefId">originalRefId</param>
 /// <param name="originalOperator">originalOperator</param>
 /// <param name="originalConditionNumber">originalConditionNumber</param>
 /// <param name="originalValue">originalValue</param>
 /// <param name="originalDeleted">originalDeleted</param>
 /// <param name="newViewId">newViewId</param>
 /// <param name="newFmType">newFmType</param>
 /// <param name="newCompanyId">newCompanyId</param>
 /// <param name="newConditionId">newConditionId</param>
 /// <param name="newRefId">newRefId</param>
 /// <param name="newOperator">newOperator</param>
 /// <param name="newConditionNumber">newConditionNumber</param>
 /// <param name="newValue_">newValue_</param>
 /// <param name="newDeleted">newDeleted</param>
 public void UpdateDirect(int originalViewId, string originalFmType, int originalCompanyId, int originalConditionId, int originalRefId, string originalOperator, int originalConditionNumber, string originalValue, bool originalDeleted, int newViewId, string newFmType, int newCompanyId, int newConditionId, int newRefId, string newOperator, int newConditionNumber, string newValue_, bool newDeleted)
 {
     FmViewConditionGateway fmViewConditionGateway = new FmViewConditionGateway(null);
     fmViewConditionGateway.Update(originalViewId, originalCompanyId, originalFmType, originalConditionId, originalRefId, originalOperator, originalConditionNumber, originalValue, originalDeleted, newViewId, newCompanyId, newFmType, newConditionId, newRefId, newOperator, newConditionNumber, newValue_, newDeleted);
 }
        /// <summary>
        /// SaveForEdit
        /// </summary>
        /// <param name="viewId">viewId</param>
        /// <param name="companyId">companyId</param>
        /// <param name="fmType">fmType</param>
        public void SaveForEdit(int viewId, int companyId, string fmType)
        {
            foreach (FmViewTDS.FmViewConditionNewRow rowNew in (FmViewTDS.FmViewConditionNewDataTable)Data.Tables["FmViewConditionNew"])
            {
                FmViewCondition fmViewCondition = new FmViewCondition(null);

                if (!rowNew.Deleted && !rowNew.InDatabase)
                {
                    FmViewConditionGateway fmViewConditionGateway = new FmViewConditionGateway(null);

                    int refId = fmViewConditionGateway.GetLastRefIdByViewIdCompanyIdFmTypeConditionId(viewId, companyId, fmType, rowNew.ConditionID);
                    refId = refId + 1;

                    fmViewCondition.InsertDirect(viewId, companyId, fmType, rowNew.ConditionID, refId, rowNew.Operator, rowNew.ConditionNumber, rowNew.Value_, rowNew.Deleted);
                }

                if (!rowNew.Deleted && rowNew.InDatabase)
                {
                    FmViewConditionGateway fmViewConditionGateway = new FmViewConditionGateway();
                    fmViewConditionGateway.LoadAllByViewIdFmTypeConditionIdRefId(viewId, companyId, fmType, rowNew.ConditionID, rowNew.RefID);

                    int originalViewId = viewId;
                    int originalCompanyId = companyId;
                    string originalFmType = fmType;
                    int originalConditionId = rowNew.ConditionID;
                    int originalRefId = rowNew.RefID; //fmViewConditionGateway.GetRefId(viewId, fmType, companyId, rowNew.ConditionID, rowNew.RefID);
                    string originalOperator_ = fmViewConditionGateway.GetOperator(viewId, fmType, companyId, rowNew.ConditionID, rowNew.RefID);
                    int originalConditionNumber = fmViewConditionGateway.GetConditionNumber(viewId, fmType, companyId, rowNew.ConditionID, rowNew.RefID);
                    string originalValue_ = fmViewConditionGateway.GetValue_(viewId, fmType, companyId, rowNew.ConditionID, rowNew.RefID);
                    bool originalDeleted = fmViewConditionGateway.GetDeleted(viewId, fmType, companyId, rowNew.ConditionID, rowNew.RefID);

                    fmViewCondition.UpdateDirect(originalViewId, originalFmType, originalCompanyId, originalConditionId, originalRefId, originalOperator_, originalConditionNumber, originalValue_, originalDeleted, viewId, fmType, companyId, rowNew.ConditionID, rowNew.RefID, rowNew.Operator, rowNew.ConditionNumber, rowNew.Value_, rowNew.Deleted);
                }

                if (rowNew.Deleted && rowNew.InDatabase)
                {
                    fmViewCondition.DeleteDirectForEditView(viewId, companyId, fmType, rowNew.ConditionID, rowNew.RefID);
                }
            }
        }
Exemplo n.º 6
0
        private void GrdConditionsAdd()
        {
            if (ValidateFooterAdd())
            {
                Page.Validate("Conditions");
                if (Page.IsValid)
                {
                    int conditionId = Int32.Parse(((DropDownList)grdConditions.FooterRow.FindControl("ddlName")).SelectedValue);
                    string name = ((DropDownList)grdConditions.FooterRow.FindControl("ddlName")).SelectedItem.Text;
                    string operator_ = ((DropDownList)grdConditions.FooterRow.FindControl("ddlOperator")).SelectedItem.Text;
                    string sign = ((DropDownList)grdConditions.FooterRow.FindControl("ddlOperator")).SelectedValue;
                    int conditionNumber = Int32.Parse(((DropDownList)grdConditions.FooterRow.FindControl("ddlConditionNumber")).SelectedValue);
                    int companyId = Int32.Parse(hdfCompanyId.Value);
                    string fmType = hdfFmType.Value;
                    int viewId = Int32.Parse(hdfViewId.Value);

                    FmTypeViewConditionGateway fmTypeViewConditionGateway = new FmTypeViewConditionGateway();
                    fmTypeViewConditionGateway.LoadByFmTypeConditionId(fmType, companyId, conditionId);
                    string type = fmTypeViewConditionGateway.GetType(fmType, companyId, conditionId);
                    string value = "";

                    if ((type == "String") || (type == "Date") || (type == "Int") || (type == "Decimal"))
                    {
                        value = ((TextBox)grdConditions.FooterRow.FindControl("tbxValue")).Text;
                    }

                    if ((type == "FixedItems") || (type == "DynamicItems"))
                    {
                        value = ((DropDownList)grdConditions.FooterRow.FindControl("ddlValue")).SelectedItem.Text.Replace("-", "");
                        value = value.Trim();
                    }

                    if (type == "Boolean")
                    {
                        if (((RadioButton)grdConditions.FooterRow.FindControl("rbtnYes")).Checked)
                            value = "Yes";
                        if (((RadioButton)grdConditions.FooterRow.FindControl("rbtnNo")).Checked)
                            value = "No";
                    }

                    FmViewTDS dataSet = new FmViewTDS();
                    dataSet.FmViewConditionNew.Merge(fmViewConditionNew, true);
                    FmViewConditionNew model = new FmViewConditionNew(dataSet);

                    FmViewConditionGateway fmViewConditionGateway = new FmViewConditionGateway();
                    int refId = fmViewConditionGateway.GetLastRefIdByViewIdCompanyIdFmTypeConditionId(viewId, companyId, fmType, conditionId);
                    refId = refId + 1;

                    model.InsertForEdit(refId, conditionId, name, operator_, sign, conditionNumber, value, false, false);

                    Session.Remove("fmViewConditionNewDummy");
                    fmViewConditionNew = dataSet.FmViewConditionNew;
                    Session["fmViewConditionNew"] = dataSet.FmViewConditionNew;

                    grdConditions.DataBind();
                    grdConditions.PageIndex = grdConditions.PageCount - 1;
                }
            }
        }
Exemplo n.º 7
0
        protected void grdConditions_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Page.Validate("ConditionsUpdate");
            if (Page.IsValid)
            {
                int id = (int)e.Keys["ID"];

                int conditionId = Int32.Parse(((DropDownList)grdConditions.Rows[e.RowIndex].Cells[3].FindControl("ddlName")).SelectedValue);
                string name = ((DropDownList)grdConditions.Rows[e.RowIndex].Cells[3].FindControl("ddlName")).SelectedItem.Text;
                DropDownList ddlOperator = ((DropDownList)grdConditions.Rows[grdConditions.EditIndex].FindControl("ddlOperator"));
                string operator_ = ddlOperator.SelectedItem.Text;
                string sign = ddlOperator.SelectedValue;
                int conditionNumber = Int32.Parse(((DropDownList)grdConditions.Rows[e.RowIndex].Cells[2].FindControl("ddlConditionNumber")).SelectedValue);

                int companyId = Int32.Parse(hdfCompanyId.Value);
                string fmType = hdfFmType.Value;

                FmTypeViewConditionGateway fmTypeViewConditionGateway = new FmTypeViewConditionGateway();
                fmTypeViewConditionGateway.LoadByFmTypeConditionId(fmType, companyId, conditionId);
                string type = fmTypeViewConditionGateway.GetType(fmType, companyId, conditionId);
                string value = "";

                if ((type == "String") || (type == "Date") || (type == "Int") || (type == "Decimal"))
                {
                    value = ((TextBox)grdConditions.Rows[e.RowIndex].Cells[5].FindControl("tbxValue")).Text;
                }

                if ((type == "FixedItems") ||(type == "DynamicItems"))
                {
                    value = ((DropDownList)grdConditions.Rows[e.RowIndex].Cells[5].FindControl("ddlValue")).SelectedItem.Text.Replace("-", "");
                    value = value.Trim();
                }

                if (type == "Boolean")
                {
                    if (((RadioButton)grdConditions.Rows[e.RowIndex].Cells[5].FindControl("rbtnYes")).Checked)
                        value = "Yes";
                    if (((RadioButton)grdConditions.Rows[e.RowIndex].Cells[5].FindControl("rbtnNo")).Checked)
                        value = "No";
                }

                FmViewTDS dataSet = new FmViewTDS();
                dataSet.FmViewConditionNew.Merge(fmViewConditionNew, true);
                FmViewConditionNew model = new FmViewConditionNew(dataSet);

                FmViewConditionGateway fmViewConditionGateway = new FmViewConditionGateway();
                int viewId = Int32.Parse(hdfViewId.Value);

                int refId = fmViewConditionGateway.GetLastRefIdByViewIdCompanyIdFmTypeConditionId(viewId, companyId, fmType, conditionId);
                refId = refId + 1;

                model.UpdateForEdit(refId, id, conditionId, name, operator_, sign, conditionNumber, value, false, false);
                Session["fmViewConditionNew"] = dataSet.FmViewConditionNew;
                fmViewConditionNew = dataSet.FmViewConditionNew;
            }
            else
            {
                e.Cancel = true;
            }
        }