Example #1
0
        //static List<string[]> SplitRequests(string request)
        //{
        //    var words = request.Split(separators, StringSplitOptions.RemoveEmptyEntries);
        //    var result = new List<string[]>();
        //    foreach (var word in words)
        //    {
        //        var resultWord = PrepareWord(word);
        //        var synonymList = Synonyms.FirstOrDefault(list => list.Any(s => MatchWord(resultWord, s)));
        //        var wordSynonyms = new List<string>() { resultWord };
        //        if (synonymList != null)
        //            wordSynonyms.AddRange(synonymList.Where(s => !MatchWord(resultWord, s)));
        //        result.Add(wordSynonyms.Distinct().ToArray());
        //    }
        //    return result;
        //}

        protected void SearchPopup_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            var text           = e.Parameter;
            var results        = DoSearch(text);
            var resultsPanel   = SearchPopup.FindControl("ResultsPanel");
            var noResultsPanel = SearchPopup.FindControl("NoResultsPanel");

            if (results.Count > 0)
            {
                resultsPanel.Visible   = true;
                noResultsPanel.Visible = false;
                var grouppedResults = results.GroupBy(c => c.loai);
                foreach (var Group in grouppedResults)
                {
                    var info  = Group.Key;
                    var group = SearchResultsNavBar.Groups.Add(Convert(info, "name"), string.Empty, string.Empty, string.Empty);
                    foreach (var res in Group)
                    {
                        group.Items.Add(res.ten, string.Empty, string.Empty, Convert(res.loai, "url") + res.id);
                    }
                }
            }
            else
            {
                resultsPanel.Visible   = false;
                noResultsPanel.Visible = true;
                var requestText = noResultsPanel.FindControl("RequestText") as HtmlGenericControl;
                requestText.InnerHtml = text;
            }
        }
Example #2
0
        //PopupControl的Callback事件
        protected void ASPxPopupControl1_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            // 将员工编号传递给自定义控件,以加载数据和照片
            ucFamily.loadFamily(e.Parameter);

            lblMsg.Text = "";
        }
        protected void popCosting_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "edit":
                PrivateSession.Instance.VoucherId = Guid.Parse(args[1]);

                dsOriginArtifact.CriteriaParameters["VoucherId"].DefaultValue = PrivateSession.Instance.VoucherId.ToString();
                dsTransaction.CriteriaParameters["VoucherId"].DefaultValue    = PrivateSession.Instance.VoucherId.ToString();

                if (PrivateSession.Instance.VoucherId != Guid.Empty)
                {
                    NAS.DAL.Vouches.PaymentVouches paymentVouches =
                        session.GetObjectByKey <NAS.DAL.Vouches.PaymentVouches>(PrivateSession.Instance.VoucherId);
                    string sumOfCreditFormatted = String.Format("{0:#,###}", paymentVouches.SumOfCredit);
                    lblSumOfCredit.Text = sumOfCreditFormatted;
                }

                this.InvisibleCommandColumnGridviewIfApprovedCosting(grdTransaction, "CommonOperations");
                //grdTransaction.DataBind();
                break;

            case "approveCosting":
                try
                {
                    TransactionBO.ProcessApproveCosting <NAS.DAL.Vouches.PaymentVouches>
                        (session, PrivateSession.Instance.VoucherId);

                    this.HideGridViewColumnsWhenApprovedCosting(grdTransaction, "CommonOperations");
                }
                catch (Exception ex)
                {
                    popCosting.JSProperties["cpException"] = ex.Message;
                }
                finally
                {
                    popCosting.JSProperties["cpEvent"] = "approveComplete";
                }
                break;

            default:
                break;
            }

            bool isApprovedCosting =
                this.HideGridViewColumnsWhenApprovedCosting(grdTransaction, "CommonOperations");

            if (isApprovedCosting)
            {
                lblIsApprovedCosting.Text = "Đã hạch toán";
            }
            else
            {
                lblIsApprovedCosting.Text = "Chưa hạch toán";
            }

            popCosting.JSProperties["cpIsApprovedCosting"] = isApprovedCosting;
        }
Example #4
0
 protected void popupItemUnitHelper_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
     if (treelistHelper.FocusedNode.Level != 1)
     {
         string id = treelistHelper.FocusedNode.Key;
         refreshContent(id);
     }
 }
Example #5
0
        protected void popup_report_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            //if (e.Parameter.ToString().Equals("S03a2-DN"))
            //{
            //    S03a3_DN r = new S03a3_DN();
            //    this.ReportViewer1.Report = r;
            //    this.ReportViewer1.DataBind();
            //    //Page.Session["2"] = null;
            //}
            //else if (e.Parameter == "2")
            //{

            //}
        }
Example #6
0
        protected void popupAllocationObjects_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            //string[] args = e.Parameter.Split('|');
            //string command = args[0];
            //if (command.Equals("Allocate"))
            //{
            //    int visibleIndex;
            //    //Get CMS object of transaction
            //    if (args.Length > 1)
            //    {
            //        visibleIndex = int.Parse(args[1]);
            //    }
            //    else
            //    {
            //        throw new Exception("Invalid parameter");
            //    }
            //    Guid transactionId = (Guid)gridviewAllocation.GetRowValues(visibleIndex, "TransactionId");
            //    TransactionId = transactionId;

            //    voidcustomFieldDataGridView_DataBind();
            //}
        }
Example #7
0
        protected void formPartnerCategoryEdit_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            //UnitOfWork uow = XpoHelpers.GetNewUnitOfWork();

            //String[] p = e.Parameter.Split('|');

            //switch (p[0])
            //{
            //    case "txtPartnerCategoryCode_Validation":

            //        string oldCode = "";
            //        string oldName = "";

            //        if (hPartnerCategoryId.Count > 0 && hPartnerCategoryId.Get("id").ToString() != "")
            //        {
            //            ViewPartnerCategory vpu = uow.GetObjectByKey<ViewPartnerCategory>(long.Parse(hPartnerCategoryId.Get("id").ToString()));

            //            if (vpu != null)
            //            {
            //                oldCode = vpu.Code;
            //                oldName = vpu.Name;
            //            }
            //        }

            //        PartnerCategory pp = uow.FindObject<PartnerCategory>(new BinaryOperator("Code", txtPartnerCategoryCode.Text));

            //        if (pp != null && oldCode != txtPartnerCategoryCode.Text)
            //        {
            //            txtPartnerCategoryCode.IsValid = false;
            //            txtPartnerCategoryCode.ValidationSettings.ErrorText = "Mã nhóm cộng tác viên này đã tồn tại !";

            //            pcPartnerCategory.JSProperties.Add("cpCheck", "txtVald");
            //        }

            //        break;
            //    default:
            //        break;
            //}
        }
Example #8
0
        protected void popZoneTreelstProductUnits_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            NAS.DAL.Nomenclature.Item.ItemUnitTypeConfig config =
                session.GetObjectByKey <NAS.DAL.Nomenclature.Item.ItemUnitTypeConfig>(Guid.Parse(e.Parameter.ToString()));
            UnitTypeCode = config.UnitTypeId.Code;
            treelstProductUnits.DataBind();

            if (config.IsMaster)
            {
                treelstProductUnits.Columns["IsDefault"].Visible   = true;
                treelstProductUnits.Columns["Coefficient"].Visible = true;
            }
            else
            {
                treelstProductUnits.Columns["IsDefault"].Visible   = false;
                treelstProductUnits.Columns["Coefficient"].Visible = false;
            }

            //if (!config.UnitTypeId.Code.Equals("SPECIFICATION"))
            //    treelstProductUnits.Columns["Action"].Visible = false;
            //else
            //    treelstProductUnits.Columns["Action"].Visible = true;
        }
        //static List<string[]> SplitRequests(string request)
        //{
        //    var words = request.Split(separators, StringSplitOptions.RemoveEmptyEntries);
        //    var result = new List<string[]>();
        //    foreach (var word in words)
        //    {
        //        var resultWord = PrepareWord(word);
        //        var synonymList = Synonyms.FirstOrDefault(list => list.Any(s => MatchWord(resultWord, s)));
        //        var wordSynonyms = new List<string>() { resultWord };
        //        if (synonymList != null)
        //            wordSynonyms.AddRange(synonymList.Where(s => !MatchWord(resultWord, s)));
        //        result.Add(wordSynonyms.Distinct().ToArray());
        //    }
        //    return result;
        //}

        protected void SearchPopup_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            var text           = e.Parameter;
            var results        = DoSearch(text);
            var resultsPanel   = SearchPopup.FindControl("ResultsPanel");
            var noResultsPanel = SearchPopup.FindControl("NoResultsPanel");

            if (results.Count > 0)
            {
                resultsPanel.Visible   = true;
                noResultsPanel.Visible = false;
                var grouppedResults = results.GroupBy(c => c.loai);
                foreach (var Group in grouppedResults)
                {
                    var info  = Group.Key;
                    var group = SearchResultsNavBar.Groups.Add(Convert(info, "name"), string.Empty, string.Empty, string.Empty);
                    foreach (var res in Group)
                    {
                        group.Items.Add(res.ten, string.Empty, string.Empty, Convert(res.loai, "url") + res.id);
                    }
                }
            }
            else
            {
                resultsPanel.Visible   = false;
                noResultsPanel.Visible = true;
                var requestText = noResultsPanel.FindControl("RequestText") as HtmlGenericControl;
                if (listDonVi != null && listDonVi.Count > 0)
                {
                    requestText.InnerHtml = "Không tìm thấy nội dung phù hợp với " + text;
                }
                else
                {
                    requestText.InnerHtml = "Bảo mật dữ liệu. Đăng nhập trước khi tìm kiếm";
                }
            }
        }
 protected void Popup_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
     Label.Text = "Button2 is clicked";
 }
Example #11
0
        /////2013-09-20 ERP-572 Khoa.Truong INS START
        //protected ActiveElementEntity ActiveElementEntity {
        //    get {
        //        Guid recordId = Guid.Empty;
        //        try
        //        {
        //            recordId = (Guid)Session["ActiveElementId"];
        //            if (recordId == Guid.Empty) return null;
        //        }
        //        catch (Exception)
        //        {
        //            return null;
        //        }
        //        ActiveElementEntity elementEntity;
        //        this.activeElementBLO.getActiveElementByKey(recordId, out elementEntity);
        //        return elementEntity;
        //    }
        //}
        /////2013-09-20 ERP-572 Khoa.Truong INS END

        protected void popManufacturerGroupEdit_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "new":
                frmlActiveElement.DataSourceID = null;
                this.ClearForm();

                /////2013-09-20 ERP-572 Khoa.Truong INS START
                Session["ActiveElementId"] = Guid.Empty;
                /////2013-09-20 ERP-572 Khoa.Truong INS END

                //popManufacturerGroupEdit.ShowOnPageLoad = true;
                break;

            case "edit":
                /*frmlActiveElement.DataSourceID = "dsManufacturerCategory";
                 * if (args.Length > 1)
                 * {
                 *  dsManufacturerCategory.CriteriaParameters["ManufacturerCategoryId"].DefaultValue = args[1];
                 * }*/

                /////2013-09-20 ERP-572 Khoa.Truong INS START
                this.ClearForm();
                /////2013-09-20 ERP-572 Khoa.Truong INS END

                // ActiveElementEntity elementEntity;
                Guid guid = new Guid(args[1]);

                /////2013-09-20 ERP-572 Khoa.Truong INS START
                Session["ActiveElementId"] = guid;
                /////2013-09-20 ERP-572 Khoa.Truong INS END

                //frmlActiveElement.DataSource = this.activeElementBLO.getActiveElementByKey(guid, out elementEntity);
                frmlActiveElement.DataBind();
                //HtmlEditorDescription.Html = elementEntity.Description;
                //popManufacturerGroupEdit.HeaderText = "Thông tin hoạt chất - Mã số: " + elementEntity.Code;
                popManufacturerGroupEdit.ShowOnPageLoad = true;

                /////2013-09-20 ERP-572 Khoa.Truong INS START
                //txtCode.Text = elementEntity.Code;
                /////2013-09-20 ERP-572 Khoa.Truong INS END

                /*HtmlEditorDescription.Html =
                 *  manufacturerCategoryBLO.getManufacturerCategoryEntity(Guid.Parse(args[1]),
                 *                                                 Utility.CurrentSession.Instance.Lang).Description;*/
                //popManufacturerGroupEdit.ShowOnPageLoad = true;
                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;
                try
                {
                    //Check validation
                    if (!ASPxEdit.AreEditorsValid(pagManufacturerGroupEdit, true))
                    {
                        popManufacturerGroupEdit.JSProperties.Add("cpInvalid", true);
                        pagManufacturerGroupEdit.ActiveTabIndex = 0;
                        return;
                    }
                    //Logic to save data
                    if (args.Length > 1)
                    {
                        //Update mode
                        recordIdStr = args[1];
                        Guid recordId = Guid.Parse(recordIdStr);
                        //ActiveElementEntity entity = new ActiveElementEntity();
                        //entity.ActiveElementId = recordId;
                        //entity.Code = txtCode.Text;
                        //entity.ActiveComponent = txtComponent.Text;
                        //entity.ActiveFunction = txtFunction.Text;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //this.activeElementBLO.updateActiveElement(entity);
                    }
                    else
                    {
                        //Insert mode
                        //ActiveElementEntity entity = new ActiveElementEntity();
                        //entity.Code = txtCode.Text;
                        //entity.ActiveComponent = txtComponent.Text;
                        //entity.ActiveFunction = txtFunction.Text;
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        ////activeElementBLO.insertActiveElement(entity);
                    }

                    //popManufacturerGroupEdit.ShowOnPageLoad = false;
                }
                catch (Exception)
                {
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    OnSaved(new WebModule.Interfaces.FormEditEventArgs()
                    {
                        isSuccess = isSuccess
                    });
                    popManufacturerGroupEdit.JSProperties.Add("cpCallbackArgs",
                                                              String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));
                }
                break;

            default:
                break;
            }
        }
Example #12
0
        protected void popManufacturerEdit_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "new":

                ManufacturerOrg tempManufacturerOrg = ManufacturerOrg.InitNewRow(session);
                PrivateSession.Instance.ManufacturerOrgId = tempManufacturerOrg.OrganizationId;
                frmManufacturerEdit.DataSourceID          = "dsManufacturer";
                dsManufacturer.CriteriaParameters["ManufacturerOrgId"].DefaultValue = PrivateSession.Instance.ManufacturerOrgId.ToString();
                ClearForm();
                //Get object id
                //Bind data to gridview

                #region add manufacturer
                session.BeginTransaction();
                try
                {
                    //ObjectType
                    ObjectType objectType =
                        ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.MANUFACTURER);

                    // object
                    NAS.BO.CMS.ObjectDocument.ObjectBO objectBO  = new NAS.BO.CMS.ObjectDocument.ObjectBO();
                    NAS.DAL.CMS.ObjectDocument.Object  cmsobject =
                        objectBO.CreateCMSObject(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.MANUFACTURER);

                    // OrganizationObject
                    OrganizationObject organizatoinObject = new OrganizationObject(session)
                    {
                        ObjectId       = cmsobject,
                        OrganizationId = tempManufacturerOrg
                    };
                    organizatoinObject.Save();

                    // OrganizationCustomType
                    OrganizationCustomType organizationCustomType = new OrganizationCustomType(session)
                    {
                        ObjectTypeId   = objectType,
                        OrganizationId = tempManufacturerOrg
                    };
                    organizationCustomType.Save();
                    session.CommitTransaction();
                }
                catch
                {
                    session.RollbackTransaction();
                }


                OrganizationObject organizationObject = tempManufacturerOrg.OrganizationObjects.FirstOrDefault();
                grid_of_Manufacturer.CMSObjectId = organizationObject.ObjectId.ObjectId;
                grid_of_Manufacturer.DataBind();
                #endregion

                //2013-11-22 Khoa.Truong DEL START
                //gridviewCustomFields.CMSObjectId = CurrentManufacturerOrg.ObjectId.ObjectId;
                //gridviewCustomFields.DataBind();
                //2013-11-22 Khoa.Truong DEL END
                break;

            case "edit":
                ClearForm();
                frmManufacturerEdit.DataSourceID = "dsManufacturer";
                if (args.Length > 1)
                {
                    PrivateSession.Instance.ManufacturerOrgId = Guid.Parse(args[1]);
                    dsManufacturer.CriteriaParameters["ManufacturerOrgId"].DefaultValue = PrivateSession.Instance.ManufacturerOrgId.ToString();
                    txtCode.Text = CurrentManufacturerOrg.Code;
                    //Get object id
                    //Bind data to gridview

                    #region edit manufacturer
                    if (CurrentManufacturerOrg.OrganizationObjects.FirstOrDefault() == null)
                    {
                        session.BeginTransaction();
                        try
                        {
                            ObjectType objectType1 =
                                ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.MANUFACTURER);

                            // object
                            NAS.BO.CMS.ObjectDocument.ObjectBO objectBO1  = new NAS.BO.CMS.ObjectDocument.ObjectBO();
                            NAS.DAL.CMS.ObjectDocument.Object  cmsobject1 =
                                objectBO1.CreateCMSObject(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.MANUFACTURER);

                            OrganizationObject organizatoinObject1 = new OrganizationObject(session)
                            {
                                ObjectId       = cmsobject1,
                                OrganizationId = CurrentManufacturerOrg
                            };
                            organizatoinObject1.Save();

                            // OrganizationCustomType
                            OrganizationCustomType organizationCustomType1 = new OrganizationCustomType(session)
                            {
                                ObjectTypeId   = objectType1,
                                OrganizationId = CurrentManufacturerOrg
                            };
                            organizationCustomType1.Save();
                            session.CommitTransaction();
                        }
                        catch (Exception)
                        {
                            session.RollbackTransaction();
                            throw;
                        }

                        OrganizationObject organizationObject1 = CurrentManufacturerOrg.OrganizationObjects.FirstOrDefault();
                        grid_of_Manufacturer.CMSObjectId = organizationObject1.ObjectId.ObjectId;
                        grid_of_Manufacturer.DataBind();
                    }

                    else
                    {
                        OrganizationObject organizationObject1 = CurrentManufacturerOrg.OrganizationObjects.FirstOrDefault();
                        grid_of_Manufacturer.CMSObjectId = organizationObject1.ObjectId.ObjectId;
                        grid_of_Manufacturer.DataBind();
                    }
                    #endregion



                    //2013-11-22 Khoa.Truong DEL START
                    //gridviewCustomFields.CMSObjectId = CurrentManufacturerOrg.ObjectId.ObjectId;
                    //gridviewCustomFields.DataBind();
                    //2013-11-22 Khoa.Truong DEL END
                }
                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;
                try
                {
                    //Check validation
                    if (!ASPxEdit.AreEditorsValid(pagMunufacturer, true))
                    {
                        popManufacturerEdit.JSProperties.Add("cpInvalid", true);
                        pagMunufacturer.ActiveTabIndex = 0;
                        return;
                    }
                    //Logic to save data
                    if (args.Length > 1)
                    {
                        //Update mode
                        //Update general information
                        recordIdStr = args[1];
                        Guid            recordId            = Guid.Parse(recordIdStr);
                        ManufacturerOrg editManufacturerOrg =
                            session.GetObjectByKey <ManufacturerOrg>(PrivateSession.Instance.ManufacturerOrgId);
                        editManufacturerOrg.Code      = txtCode.Text;
                        editManufacturerOrg.Name      = txtName.Text;
                        editManufacturerOrg.RowStatus = short.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        editManufacturerOrg.Save();
                    }
                    else
                    {
                        //Insert mode
                        ManufacturerOrg newManufacturerOrg =
                            session.GetObjectByKey <ManufacturerOrg>(PrivateSession.Instance.ManufacturerOrgId);
                        newManufacturerOrg.Code      = txtCode.Text;
                        newManufacturerOrg.Name      = txtName.Text;
                        newManufacturerOrg.RowStatus = short.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        newManufacturerOrg.Save();
                    }
                }
                catch (Exception ex)
                {
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    popManufacturerEdit.JSProperties.Add("cpCallbackArgs",
                                                         String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));
                }
                break;

            default:
                break;
            }
        }
Example #13
0
        protected void popupCustomFieldAttachment_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            try
            {
                string[] args = e.Parameter.Split('|');
                NAS.DAL.CMS.ObjectDocument.CustomField customField = null;
                string command = args[0];
                switch (command)
                {
                    #region AttachTo
                case "AttachTo":
                    //Get CustomField
                    if (args.Length > 1)
                    {
                        CustomFieldId = Guid.Parse(args[1]);
                    }
                    else
                    {
                        throw new Exception("Invalid parameter");
                    }
                    customField = GetCurrentCustomField(session);

                    //Bind data to form
                    formlayoutCustomFieldAttachment_DataBind();

                    /////Set Selection for gridview
                    gridviewObjectType.Selection.UnselectAll();
                    if (customField.ObjectTypeCustomFields != null)
                    {
                        foreach (var objectTypeCustomField in customField.ObjectTypeCustomFields)
                        {
                            gridviewObjectType.Selection
                            .SetSelectionByKey(objectTypeCustomField.ObjectTypeId.ObjectTypeId, true);
                        }
                    }
                    break;
                    #endregion

                    #region Save
                case "Save":
                    using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
                    {
                        //Delete all object type custom field which it's type is not master and system
                        customField = GetCurrentCustomField(uow);
                        var userDefinedObjectTypeCustomFields = customField.ObjectTypeCustomFields.Where(r =>
                                                                                                         !r.CustomFieldType.Equals(CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER) &&
                                                                                                         !r.CustomFieldType.Equals(CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER_READONLY) &&
                                                                                                         !r.CustomFieldType.Equals(CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_READONLY)).ToList();
                        uow.Delete(userDefinedObjectTypeCustomFields);
                        //Get selection to save
                        var selectedObjectTypeIds = gridviewObjectType.GetSelectedFieldValues("ObjectTypeId")
                                                    .Select(r => Guid.Parse(r.ToString()));

                        //Update object custom field table
                        foreach (var selectedObjectTypeId in selectedObjectTypeIds)
                        {
                            //Check exist
                            int count = customField.ObjectTypeCustomFields.Where(r =>
                                                                                 r.CustomFieldType.Equals(CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER) ||
                                                                                 r.CustomFieldType.Equals(CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER_READONLY) ||
                                                                                 r.CustomFieldType.Equals(CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_READONLY))
                                        .Count(r => r.ObjectTypeId.ObjectTypeId == selectedObjectTypeId);
                            if (count != 0)
                            {
                                continue;
                            }
                            //get ObjectType
                            ObjectType objectType = uow.GetObjectByKey <ObjectType>(selectedObjectTypeId);
                            //Create new ObjectTypeCustomField
                            ObjectTypeCustomField objectTypeCustomField = new ObjectTypeCustomField(uow)
                            {
                                CustomFieldId = customField,
                                ObjectTypeId  = objectType
                            };
                            objectTypeCustomField.Save();
                        }
                        uow.CommitChanges();
                    }
                    break;
                    #endregion

                default:
                    break;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #14
0
 protected void pcPersonal_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
 }
Example #15
0
 protected void popManutencaoUsuario_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
     //ImgFotoUsuario.ContentBytes = (byte[]) coHash.Value;
 }
Example #16
0
        //private ManufacturerCategoryBLO manufacturerCategoryBLO;

        //protected ManufacturerCategoryEntity ManufacturerCategoryEntity {
        //    get {
        //        Guid recordId = Guid.Empty;
        //        try
        //        {
        //            recordId = (Guid)Session["ManufacturerCategoryId"];
        //            if (recordId == Guid.Empty) return null;
        //        }
        //        catch (Exception)
        //        {
        //            return null;
        //        }
        //        return manufacturerCategoryBLO.
        //            getManufacturerCategoryEntity(recordId, Utility.CurrentSession.Instance.Lang);
        //    }
        //}

        protected void popManufacturerGroupEdit_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "new":
                Session["ManufacturerCategoryId"]    = Guid.Empty;
                frmlManufactureCategory.DataSourceID = null;
                ClearForm();
                //popManufacturerGroupEdit.ShowOnPageLoad = true;
                break;

            case "edit":
                ClearForm();
                frmlManufactureCategory.DataSourceID = "dsManufacturerCategory";
                if (args.Length > 1)
                {
                    Session["ManufacturerCategoryId"] = Guid.Parse(args[1]);

                    dsManufacturerCategory.CriteriaParameters["ManufacturerCategoryId"].DefaultValue = args[1];
                    dsManufacturerCategory.CriteriaParameters["Language"].DefaultValue = Utility.CurrentSession.Instance.Lang;

                    //ManufacturerCategoryEntity manufacturerCategoryEntity = this.ManufacturerCategoryEntity;
                    //HtmlEditorDescription.Html = manufacturerCategoryEntity.Description;
                    //txtCode.Text = manufacturerCategoryEntity.Code;
                }

                //popManufacturerGroupEdit.ShowOnPageLoad = true;
                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;
                try
                {
                    //Check validation
                    if (!ASPxEdit.AreEditorsValid(pagManufacturerGroupEdit, true))
                    {
                        popManufacturerGroupEdit.JSProperties.Add("cpInvalid", true);
                        pagManufacturerGroupEdit.ActiveTabIndex = 0;
                        return;
                    }
                    //Logic to save data
                    if (args.Length > 1)
                    {
                        //Update mode
                        recordIdStr = args[1];
                        Guid recordId = Guid.Parse(recordIdStr);
                        //ManufacturerCategoryEntity entity = new ManufacturerCategoryEntity();
                        //entity.ManufacturerCategoryId = recordId;
                        //entity.Code = txtCode.Text;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //manufacturerCategoryBLO.Update(entity);
                    }
                    else
                    {
                        //Insert mode
                        //ManufacturerCategoryEntity entity = new ManufacturerCategoryEntity();
                        //entity.Code = txtCode.Text;
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;
                        //manufacturerCategoryBLO.Insert(entity);
                    }

                    //popManufacturerGroupEdit.ShowOnPageLoad = false;
                }
                catch (Exception ex)
                {
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    OnSaved(new FormEditEventArgs()
                    {
                        isSuccess = isSuccess
                    });
                    popManufacturerGroupEdit.JSProperties.Add("cpCallbackArgs",
                                                              String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));
                }
                break;

            default:
                break;
            }
        }
Example #17
0
        protected void popBuyingService_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "new":
                PrivateSession.Instance.BuyingServiceId = Guid.Empty;
                this.LoadBuyingServiceBuyingServiceCategoryEntities(Guid.Empty);
                this.LoadBuyingServiceSupplierEntities(Guid.Empty);
                this.LoadBuyingServiceEquivalenceEntities(Guid.Empty);
                frmBuyingService.DataSourceID = null;
                ClearForm();
                break;

            case "edit":
                ClearForm();
                frmBuyingService.DataSourceID = dsBuyingServiceProperty.ID;
                if (args.Length > 1)
                {
                    Guid buyingServiceId = Guid.Parse(args[1]);
                    PrivateSession.Instance.BuyingServiceId = buyingServiceId;

                    this.LoadBuyingServiceBuyingServiceCategoryEntities(buyingServiceId);
                    this.LoadBuyingServiceEquivalenceEntities(buyingServiceId);
                    this.LoadBuyingServiceSupplierEntities(buyingServiceId);

                    dsBuyingServiceProperty.CriteriaParameters["BuyingServiceId"].DefaultValue = buyingServiceId.ToString();
                    dsBuyingServiceProperty.CriteriaParameters["Language"].DefaultValue        = Utility.CurrentSession.Instance.Lang;

                    //HtmlEditorDescription.Html = BuyingServiceEntity.Description;
                    //txtCode.Text = BuyingServiceEntity.Code;
                }
                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;
                try
                {
                    //Check validation
                    if (!ASPxEdit.AreEditorsValid(pagBuyingService, true))
                    {
                        popBuyingService.JSProperties.Add("cpInvalid", true);
                        pagBuyingService.ActiveTabIndex = 0;
                        return;
                    }
                    //Logic to save data
                    if (args.Length > 1)
                    {
                        //Update mode
                        recordIdStr = args[1];
                        Guid recordId = Guid.Parse(recordIdStr);
                        //BuyingServiceEntity entity = new BuyingServiceEntity();
                        //entity.BuyingServiceId = recordId;
                        //entity.Code = txtCode.Text;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;

                        //entity.BuyingServiceBuyingServiceCategoryEntities =
                        //    PrivateSession.Instance.BuyingServiceBuyingServiceCategoryEntities;

                        //entity.BuyingServiceSupplierEntities =
                        //    PrivateSession.Instance.BuyingServiceSupplierEntities;

                        //entity.BuyingServiceEquivalenceEntities =
                        //    PrivateSession.Instance.BuyingServiceEquivalenceEntities;

                        //buyingServiceBLO.Update(entity);
                    }
                    else
                    {
                        //Insert mode
                        //BuyingServiceEntity entity = new BuyingServiceEntity();
                        //entity.Code = txtCode.Text;
                        //entity.Language = Utility.CurrentSession.Instance.Lang;
                        //entity.RowStatus = char.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //entity.Name = txtName.Text;
                        //entity.Description = HtmlEditorDescription.Html;

                        //entity.BuyingServiceBuyingServiceCategoryEntities =
                        //    PrivateSession.Instance.BuyingServiceBuyingServiceCategoryEntities;

                        //entity.BuyingServiceSupplierEntities =
                        //    PrivateSession.Instance.BuyingServiceSupplierEntities;

                        //entity.BuyingServiceEquivalenceEntities =
                        //    PrivateSession.Instance.BuyingServiceEquivalenceEntities;

                        //buyingServiceBLO.Insert(entity);
                    }
                }
                catch (Exception)
                {
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    popBuyingService.JSProperties.Add("cpCallbackArgs",
                                                      String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));

                    PrivateSession.ClearInstance();
                }
                break;

            default:
                break;
            }
        }
Example #18
0
 protected void ASPxPopupControl1_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
     ucLeave.loadLeave(e.Parameter);
 }
Example #19
0
        protected void popCustomerEdit_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            string[] args = e.Parameter.Split('|');
            switch (args[0])
            {
            case "new":
                CustomerOrg tempCustomerOrg = CustomerOrg.InitNewRow(session);
                PrivateSession.Instance.CustomerOrgId = tempCustomerOrg.OrganizationId;
                dsCustomer.CriteriaParameters["CustomerOrgId"].DefaultValue = PrivateSession.Instance.CustomerOrgId.ToString();
                ClearForm();
                initLbCustomerTypeForAdding();

                #region customer

                session.BeginTransaction();
                try
                {
                    ObjectType objectType_cus =
                        ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.CUSTOMER);

                    NAS.BO.CMS.ObjectDocument.ObjectBO objectBO_cus  = new NAS.BO.CMS.ObjectDocument.ObjectBO();
                    NAS.DAL.CMS.ObjectDocument.Object  cmsObject_cus =
                        objectBO_cus.CreateCMSObject(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.CUSTOMER);

                    // OrganizationObject
                    OrganizationObject organizatoinObject_cus = new OrganizationObject(session)
                    {
                        ObjectId       = cmsObject_cus,
                        OrganizationId = tempCustomerOrg
                    };
                    organizatoinObject_cus.Save();

                    // OrganizationCustomType
                    OrganizationCustomType organizationCustomType_cus = new OrganizationCustomType(session)
                    {
                        ObjectTypeId   = objectType_cus,
                        OrganizationId = tempCustomerOrg
                    };
                    organizationCustomType_cus.Save();
                    session.CommitTransaction();
                }
                catch (Exception)
                {
                    session.RollbackTransaction();
                    throw;
                }


                if (lbCustomerType.Items[0].Selected == true)
                {
                    xCallbackPanel_customer.Visible = true;

                    ObjectType objectType_cus1 =
                        ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.CUSTOMER);
                    OrganizationObject organizationObject_sup = tempCustomerOrg.OrganizationObjects
                                                                .Where(r => r.ObjectId.ObjectTypeId == objectType_cus1).FirstOrDefault();
                    grid_customer.CMSObjectId = organizationObject_sup.ObjectId.ObjectId;
                    grid_customer.DataBind();
                    //grid_customer.CMSObjectId = cmsObject_cus.ObjectId;
                    //grid_customer.DataBind();
                }
                else
                {
                    xCallbackPanel_customer.Visible = false;
                }

                #endregion

                #region supplier

                session.BeginTransaction();
                try
                {
                    ObjectType objectType_sup =
                        ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.SUPPLIER);

                    NAS.BO.CMS.ObjectDocument.ObjectBO objectBO_sup  = new NAS.BO.CMS.ObjectDocument.ObjectBO();
                    NAS.DAL.CMS.ObjectDocument.Object  cmsObject_sup =
                        objectBO_sup.CreateCMSObject(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.SUPPLIER);

                    // OrganizationObject
                    OrganizationObject organizatoinObject_sup = new OrganizationObject(session)
                    {
                        ObjectId       = cmsObject_sup,
                        OrganizationId = tempCustomerOrg
                    };
                    organizatoinObject_sup.Save();

                    // OrganizationCustomType
                    OrganizationCustomType organizationCustomType_sup = new OrganizationCustomType(session)
                    {
                        ObjectTypeId   = objectType_sup,
                        OrganizationId = tempCustomerOrg
                    };
                    organizationCustomType_sup.Save();
                    session.CommitTransaction();
                }
                catch (Exception)
                {
                    session.RollbackTransaction();
                    throw;
                }


                if (lbCustomerType.Items[1].Selected == true)
                {
                    xCallbackPanel_supplier.Visible = true;

                    ObjectType objectType_sup1 =
                        ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.SUPPLIER);
                    OrganizationObject organizationObject_sup = tempCustomerOrg.OrganizationObjects
                                                                .Where(r => r.ObjectId.ObjectTypeId == objectType_sup1).FirstOrDefault();
                    grid_supplier.CMSObjectId = organizationObject_sup.ObjectId.ObjectId;
                    grid_supplier.DataBind();
                    //grid_supplier.CMSObjectId = cmsObject_sup.ObjectId;
                    //grid_supplier.DataBind();
                }
                else
                {
                    xCallbackPanel_supplier.Visible = false;
                }
                #endregion

                break;

            case "edit":
                ClearForm();
                if (args.Length > 1)
                {
                    PrivateSession.Instance.CustomerOrgId = Guid.Parse(args[1]);
                    dsCustomer.CriteriaParameters["CustomerOrgId"].DefaultValue = PrivateSession.Instance.CustomerOrgId.ToString();
                    txtCode.Text = CurrentCustomerOrg.Code;
                    loadLbCustomerType();

                    if (CurrentCustomerOrg.OrganizationObjects.FirstOrDefault() == null)
                    {
                        #region customer
                        session.BeginTransaction();
                        try
                        {
                            ObjectType objectType_cus1 =
                                ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.CUSTOMER);

                            NAS.BO.CMS.ObjectDocument.ObjectBO objectBO_cus1  = new NAS.BO.CMS.ObjectDocument.ObjectBO();
                            NAS.DAL.CMS.ObjectDocument.Object  cmsObject_cus1 =
                                objectBO_cus1.CreateCMSObject(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.CUSTOMER);

                            // OrganizationObject
                            OrganizationObject organizatoinObject_cus1 = new OrganizationObject(session)
                            {
                                ObjectId       = cmsObject_cus1,
                                OrganizationId = CurrentCustomerOrg
                            };
                            organizatoinObject_cus1.Save();

                            // OrganizationCustomType
                            OrganizationCustomType organizationCustomType_cus1 = new OrganizationCustomType(session)
                            {
                                ObjectTypeId   = objectType_cus1,
                                OrganizationId = CurrentCustomerOrg
                            };
                            organizationCustomType_cus1.Save();
                            session.CommitTransaction();
                        }
                        catch (Exception)
                        {
                            session.RollbackTransaction();
                            throw;
                        }


                        if (lbCustomerType.Items[0].Selected == true)
                        {
                            xCallbackPanel_customer.Visible = true;

                            ObjectType objectType_cus1 =
                                ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.CUSTOMER);
                            OrganizationObject organizationObject_sup = CurrentCustomerOrg.OrganizationObjects
                                                                        .Where(r => r.ObjectId.ObjectTypeId == objectType_cus1).FirstOrDefault();
                            grid_customer.CMSObjectId = organizationObject_sup.ObjectId.ObjectId;
                            grid_customer.DataBind();
                            //grid_customer.CMSObjectId = cmsObject_cus1.ObjectId;
                            //grid_customer.DataBind();
                        }
                        else
                        {
                            xCallbackPanel_customer.Visible = false;
                        }
                        #endregion

                        #region supplier

                        session.BeginTransaction();
                        try
                        {
                            ObjectType objectType_sup1 =
                                ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.SUPPLIER);

                            NAS.BO.CMS.ObjectDocument.ObjectBO objectBO_sup1  = new NAS.BO.CMS.ObjectDocument.ObjectBO();
                            NAS.DAL.CMS.ObjectDocument.Object  cmsObject_sup1 =
                                objectBO_sup1.CreateCMSObject(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.SUPPLIER);

                            // OrganizationObject
                            OrganizationObject organizatoinObject_sup1 = new OrganizationObject(session)
                            {
                                ObjectId       = cmsObject_sup1,
                                OrganizationId = CurrentCustomerOrg
                            };
                            organizatoinObject_sup1.Save();

                            // OrganizationCustomType
                            OrganizationCustomType organizationCustomType_sup1 = new OrganizationCustomType(session)
                            {
                                ObjectTypeId   = objectType_sup1,
                                OrganizationId = CurrentCustomerOrg
                            };
                            organizationCustomType_sup1.Save();
                            session.CommitTransaction();
                        }
                        catch (Exception)
                        {
                            session.RollbackTransaction();
                            throw;
                        }


                        if (lbCustomerType.Items[1].Selected == true)
                        {
                            xCallbackPanel_supplier.Visible = true;

                            ObjectType objectType_sup1 =
                                ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.SUPPLIER);
                            OrganizationObject organizationObject_sup = CurrentCustomerOrg.OrganizationObjects
                                                                        .Where(r => r.ObjectId.ObjectTypeId == objectType_sup1).FirstOrDefault();
                            grid_supplier.CMSObjectId = organizationObject_sup.ObjectId.ObjectId;
                            grid_supplier.DataBind();
                            //grid_supplier.CMSObjectId = cmsObject_sup1.ObjectId;
                            //grid_supplier.DataBind();
                        }
                        else
                        {
                            xCallbackPanel_supplier.Visible = false;
                        }
                        #endregion
                    }

                    else
                    {
                        #region load customer data
                        if (lbCustomerType.Items[0].Selected == true)
                        {
                            xCallbackPanel_customer.Visible = true;
                            ObjectType objectType_cus1 =
                                ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.CUSTOMER);
                            OrganizationObject organizationObject_sup = CurrentCustomerOrg.OrganizationObjects
                                                                        .Where(r => r.ObjectId.ObjectTypeId == objectType_cus1).FirstOrDefault();
                            grid_customer.CMSObjectId = organizationObject_sup.ObjectId.ObjectId;
                            grid_customer.DataBind();
                        }
                        else
                        {
                            xCallbackPanel_customer.Visible = false;
                        }
                        #endregion

                        #region load supplier data
                        if (lbCustomerType.Items[1].Selected == true)
                        {
                            xCallbackPanel_supplier.Visible = true;
                            ObjectType objectType_sup1 =
                                ObjectType.GetDefault(session, NAS.DAL.CMS.ObjectDocument.ObjectTypeEnum.SUPPLIER);
                            OrganizationObject organizationObject_sup = CurrentCustomerOrg.OrganizationObjects
                                                                        .Where(r => r.ObjectId.ObjectTypeId == objectType_sup1).FirstOrDefault();
                            grid_supplier.CMSObjectId = organizationObject_sup.ObjectId.ObjectId;
                            grid_supplier.DataBind();
                        }
                        else
                        {
                            xCallbackPanel_supplier.Visible = false;
                        }
                        #endregion
                    }
                }
                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;
                try
                {
                    session.BeginTransaction();
                    //Check validation
                    if (!IsSelectedLbType())
                    {
                        throw new Exception(String.Format("Phải chọn ít nhất một phân loại cho khách hàng"));
                    }

                    if (!ASPxEdit.AreEditorsValid(pagCustomer, true))
                    {
                        popCustomerEdit.JSProperties.Add("cpInvalid", true);
                        pagCustomer.ActiveTabIndex = 0;
                        return;
                    }
                    //Logic to save data
                    if (args.Length > 1)
                    {
                        //Update mode
                        //Update general information
                        recordIdStr = args[1];
                        Guid         recordId        = Guid.Parse(recordIdStr);
                        Organization editCustomerOrg =
                            session.GetObjectByKey <Organization>(PrivateSession.Instance.CustomerOrgId);
                        editCustomerOrg.Code      = txtCode.Text;
                        editCustomerOrg.Name      = txtName.Text;
                        editCustomerOrg.TaxNumber = txtTaxNumber.Text;
                        // Duc.Vo 10/09/2013 INS-START
                        editCustomerOrg.Address = txtAddress.Text;
                        // Duc.Vo 10/09/2013 INS-START
                        editCustomerOrg.RowStatus = short.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        //----Duc.Vo 03/11/2013 INS -START
                        selectedObjectTypeId = new List <Guid>();
                        foreach (ListEditItem l in lbCustomerType.Items)
                        {
                            if (l.Selected)
                            {
                                selectedObjectTypeId.Add(Guid.Parse(l.Value.ToString()));
                            }
                        }

                        if (editCustomerOrg is SupplierOrg)
                        {
                            supplierBO.updateTradingCategoriesForObject <SupplierOrg>(session, recordId, selectedObjectTypeId);
                        }
                        else
                        {
                            supplierBO.updateTradingCategoriesForObject <CustomerOrg>(session, recordId, selectedObjectTypeId);
                        }
                        //----Duc.Vo 03/11/2013 INS -END

                        editCustomerOrg.Save();
                        session.CommitTransaction();
                    }
                    else
                    {
                        //Insert mode
                        CustomerOrg newCustomerOrg =
                            session.GetObjectByKey <CustomerOrg>(PrivateSession.Instance.CustomerOrgId);
                        newCustomerOrg.Code      = txtCode.Text;
                        newCustomerOrg.Name      = txtName.Text;
                        newCustomerOrg.TaxNumber = txtTaxNumber.Text;
                        // Duc.Vo 10/09/2013 INS-START
                        newCustomerOrg.Address = txtAddress.Text;
                        // Duc.Vo 10/09/2013 INS-START
                        newCustomerOrg.RowStatus = short.Parse(cbRowStatus.SelectedItem.Value.ToString());
                        newCustomerOrg.Save();
                        //----Duc.Vo 03/11/2013 INS -START
                        selectedObjectTypeId = new List <Guid>();
                        foreach (ListEditItem l in lbCustomerType.Items)
                        {
                            if (l.Selected)
                            {
                                selectedObjectTypeId.Add(Guid.Parse(l.Value.ToString()));
                            }
                        }
                        supplierBO.updateTradingCategoriesForObject <CustomerOrg>(session, newCustomerOrg.OrganizationId, selectedObjectTypeId);
                        //----Duc.Vo 03/11/2013 INS -END
                        session.CommitTransaction();
                    }
                }
                catch (Exception ex)
                {
                    session.RollbackTransaction();
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    popCustomerEdit.JSProperties.Add("cpCallbackArgs",
                                                     String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));
                }
                break;

            default:
                break;
            }
        }
Example #20
0
 protected void formPartnerEdit_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
 }
Example #21
0
 protected void formInvoiceVatReport_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
     if (ReportHiddenField.Contains("typeReport"))
     {
     }
 }
Example #22
0
 protected void formBillActor_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
 }
Example #23
0
        protected void popReceiptVouchesEdit_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
        {
            string[]         args = e.Parameter.Split('|');
            ReceiptVouchesBO bo   = new ReceiptVouchesBO(); //ham dinh nghia ben NAS.BO

            switch (args[0])
            {
            //DND 851
            case "cbo_click":
                if (args.Length > 1)
                {
                    string textAdsress = "";
                    if (args[1].Equals(""))
                    {
                        textAdsress = "";
                    }
                    else
                    {
                        string[] org_code = args[1].ToString().Split('-');
                        org_code[0] = org_code[0].Trim();
                        textAdsress = bo.searchOrgnAdress(session, org_code[0]);
                    }

                    memoAddress.Value = textAdsress;
                    txtPayer.Focus();
                }
                break;

            //END DND 851
            case "new":
                ReceiptVouches tempReceiptVouches = ReceiptVouches.InitNewRow(session);
                popReceiptVouchesEdit.JSProperties["cpNewRecordId"]           = tempReceiptVouches.VouchesId.ToString();
                PrivateSession.Instance.ReceiptVoucherId                      = tempReceiptVouches.VouchesId;
                dsReceiptVouches.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString();
                dsVouchersAmount.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString();
                this.InvisibleCommandColumnGridviewIfApprovedCosting(grdVouchersAmount, "CommonOperations");
                ClearForm();
                txtCode.Text = artifactCodeRuleBO.GetArtifactCodeOfArtifactType(ArtifactTypeEnum.VOUCHER_RECEIPT);
                //DND 851
                dateIssuedDate.Value = DateTime.Now;


                //END DND
                break;

            case "edit":
                ClearForm();
                if (args.Length > 1)
                {
                    PrivateSession.Instance.ReceiptVoucherId = Guid.Parse(args[1]);
                    dsReceiptVouches.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString();
                    dsVouchersAmount.CriteriaParameters["VouchesId"].DefaultValue = PrivateSession.Instance.ReceiptVoucherId.ToString();
                    txtCode.Text = CurrentReceiptVouches.Code;
                    this.InvisibleCommandColumnGridviewIfApprovedCosting(grdVouchersAmount, "CommonOperations");
                    //DND
                    if (bo.searchOrgDefault(session, CurrentReceiptVouches.SourceOrganizationId.OrganizationId.ToString()))
                    {
                        popReceiptVouchesEdit.JSProperties.Add("cpIsDefaultSourceOrg", true);
                    }
                    else
                    {
                        popReceiptVouchesEdit.JSProperties.Add("cpIsDefaultSourceOrg", false);
                    }
                    //END DND
                }
                break;

            case "save":
                bool   isSuccess   = true;
                string recordIdStr = null;

                try
                {
                    //Check validation
                    if (!ASPxEdit.AreEditorsValid(frmReceiptVouches, true))
                    {
                        popReceiptVouchesEdit.JSProperties.Add("cpInvalid", true);
                        return;
                    }

                    //collect data for saving
                    string   code      = txtCode.Text;
                    DateTime issueDate = new DateTime();
                    if (!DateTime.TryParse(dateIssuedDate.Text, out issueDate))
                    {
                        issueDate = DateTime.Now;
                    }

                    string description = memoDescription.Text;
                    string address     = memoAddress.Text;
                    //2013-11-18 Khoa.Truong INS START
                    //Guid voucherTypeId = Guid.Parse(cbVouchesType.SelectedItem.Value.ToString());
                    //Guid sourceOrgId = Guid.Parse(cbSourceOrganization.SelectedItem.Value.ToString());
                    //2013-11-18 Khoa.Truong INS END

                    //2013-11-18 Khong.Truong DEL START
                    ////DND 851
                    Guid sourceOrgId;
                    bo = new ReceiptVouchesBO();     //ham dinh nghia ben NAS.BO
                    string cbVouchesType_name = cbVouchesType.Text;


                    if (cbSourceOrganization.Text == null || cbSourceOrganization.Text.Equals(""))
                    {
                        sourceOrgId = Guid.Parse(bo.searchOrganizationId(session));
                    }
                    else
                    {
                        string[] org_code = cbSourceOrganization.Text.ToString().Split('-');

                        org_code[0] = org_code[0].Trim();

                        sourceOrgId = Guid.Parse(bo.searchOrgId(session, org_code[0]));
                    }
                    Guid voucherTypeId = Guid.Parse(bo.searchVouchesTypeId(session, cbVouchesType_name));
                    ////END DND
                    //2013-11-18 Khong.Truong DEL END

                    string payer = txtPayer.Text;
                    //Logic to save data

                    if (args.Length > 1)
                    {
                        //Update mode
                        //Update general information
                        recordIdStr = args[1];
                        Guid             recordId         = Guid.Parse(recordIdStr);
                        ReceiptVouchesBO receiptVouchesBO = new ReceiptVouchesBO();
                        receiptVouchesBO.Update(PrivateSession.Instance.ReceiptVoucherId,
                                                code,
                                                issueDate,
                                                description,
                                                address,
                                                payer,
                                                Constant.ROWSTATUS_ACTIVE,
                                                sourceOrgId,
                                                Utility.CurrentSession.Instance.AccessingOrganizationId,
                                                voucherTypeId);
                    }
                    else
                    {
                        //Insert mode
                        ReceiptVouchesBO receiptVouchesBO = new ReceiptVouchesBO();
                        receiptVouchesBO.Insert(PrivateSession.Instance.ReceiptVoucherId,
                                                code,
                                                issueDate,
                                                description,
                                                address,
                                                payer,
                                                Constant.ROWSTATUS_ACTIVE,
                                                sourceOrgId,
                                                Utility.CurrentSession.Instance.AccessingOrganizationId,
                                                voucherTypeId);
                    }
                }
                catch (Exception ex)
                {
                    isSuccess = false;
                    throw;
                }
                finally
                {
                    popReceiptVouchesEdit.JSProperties.Add("cpCallbackArgs",
                                                           String.Format("{{ \"recordId\": \"{0}\", \"isSuccess\": {1} }}", recordIdStr, isSuccess.ToString().ToLower()));
                }
                break;

            default:
                break;
            }
        }
Example #24
0
 protected void formReportViewer_WindowCallback(object source, DevExpress.Web.ASPxPopupControl.PopupWindowCallbackArgs e)
 {
 }