Beispiel #1
0
        //Metodo que se ejecuta el MasterView
        protected void btnDescargarDS_OnClick(object sender, EventArgs e)
        {
            try
            {
                MultiView1.ActiveViewIndex = 1;
                h2_titulo.InnerHtml        = "Descarga Expediente -> Descarga Data Stage";

                if (Session["DS"] == null)
                {
                    string    mensaje = string.Empty;
                    DataTable dt2     = new DataTable();
                    dt2           = exp.Consulta_DATA_STAGE(lblCadena.Text, ref mensaje);
                    Session["DS"] = dt2;
                }

                GridDS.DataSource = Session["DS"];
                GridDS.DataBind();
                GridDS.Settings.VerticalScrollableHeight = 280;
                GridDS.Settings.VerticalScrollBarMode    = ScrollBarMode.Visible;
            }
            catch (Exception ex)
            {
                int    idusuario = 0;
                string mensaje   = "";
                if (Session["IdUsuario"] != null)
                {
                    idusuario = int.Parse(Session["IdUsuario"].ToString());
                }
                excepcion.RegistrarExcepcion(idusuario, "DescargaExpediente-btnDescargarDS_OnClick", ex, lblCadena.Text, ref mensaje);
            }
        }
Beispiel #2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            GridED.SettingsPager.PageSize = GridPageSize;

            #region Grid Principal

            //Cuando se quiera filtrar el Grid entra en el if
            if (Session["GridED"] != null)
            {
                GridED.DataSource = Session["GridED"];
                GridED.DataBind();
                GridED.SettingsPager.PageSize = GridPageSize;
            }

            #endregion

            #region Cuenta Gastos

            //Cuando se quiera filtrar el GridDS entra en el if
            if (Session["DS"] != null)
            {
                GridDS.DataSource = Session["DS"];
                GridDS.DataBind();
                GridDS.SettingsPager.PageSize = GridPageSizeDS;
            }

            #endregion
        }
Beispiel #3
0
        /// <summary>
        /// Users request to query the db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnExecuteQuery_Click(object sender, EventArgs e)
        {
            //Secondary security fix
            if (IsEditable && txtQuery.Text.ToLower().StartsWith("select"))
            {
                try
                {
                    var ds = ExportHelper.ReturnDataSet(txtQuery.Text);
                    if (ds != null)
                    {
                        GridDS.DataSource = ds;
                        GridDS.DataBind();

                        //Check if the gridds has records on it, we show the exporter buttons
                        liExportCsv.Visible = GridDS.Rows.Count > 0;
                        liExportXml.Visible = GridDS.Rows.Count > 0;
                    }
                }
                catch (Exception ex)
                {
                    Skin.AddModuleMessage(this, "Query Error: " + ex.Message, ModuleMessage.ModuleMessageType.RedError);
                    GridDS.DataSource = null;
                    GridDS.DataBind();
                }
            }
            else
            {
                Skin.AddModuleMessage(this, "Your query MUST start with the word SELECT",
                                      ModuleMessage.ModuleMessageType.RedError);
            }
        }
Beispiel #4
0
        //Botón en columna Nombre, abre archivo
        protected void ASPxButtonDoc_Click(object sender, EventArgs e)
        {
            try
            {
                ASPxButton btn = (ASPxButton)sender;

                btn.ImageUrl = "~/img/iconos/ico_doc1.png";

                GridViewDataItemTemplateContainer container = (GridViewDataItemTemplateContainer)btn.NamingContainer;
                string v_FILESDSKEY = GridDS.GetRowValues(container.VisibleIndex, "FILESDSKEY").ToString().Trim();
                string v_NOMBRE     = GridDS.GetRowValues(container.VisibleIndex, "DSNAME").ToString().Trim();

                Guid guidkey = Guid.Parse(v_FILESDSKEY);

                string    mensaje = string.Empty;
                DataTable dt      = new DataTable();
                byte[]    vByte;
                vByte = exp.Trae_Archivo_DATA_STAGE(guidkey, lblCadena.Text, ref mensaje);

                Response.Clear();
                MemoryStream ms = new MemoryStream(vByte);
                Response.ContentType = "application/zip";
                Response.AddHeader("content-disposition", "attachment;filename=" + v_NOMBRE);
                Response.Buffer = true;
                ms.WriteTo(Response.OutputStream);
                HttpContext.Current.ApplicationInstance.CompleteRequest();
                Response.End();
            }
            catch (Exception ex) {}
        }
        /// <summary>
        /// 将Grid数据赋值给【详情】Tab内的对应控件
        /// </summary>
        private void SetGridDataToCardCtrls()
        {
            //判断是否允许将【列表】Grid数据设置到【详情】Tab内的对应控件
            if (!IsAllowSetGridDataToCard())
            {
                return;
            }

            SetCardCtrlsToDetailDS();
            base.NewUIModel = DetailDS;

            var activeRowIndex = gdGrid.ActiveRow.Index;

            //判断Grid内[唯一标识]是否为空
            if (gdGrid.Rows[activeRowIndex].Cells[SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID].Value == null ||
                string.IsNullOrEmpty(gdGrid.Rows[activeRowIndex].Cells[SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID].Value.ToString()))
            {
                return;
            }
            //将选中的Grid行对应数据Model赋值给[DetailDS]
            //********************************************************************************
            //**********************************【重要说明】**********************************
            //*****此处和上面的条件判断必须用GridDS内能唯一标识一条记录的字段作为过滤条件*****
            //********************************************************************************
            DetailDS = GridDS.FirstOrDefault(x => x.APN_ID == gdGrid.Rows[activeRowIndex].Cells[SystemTableColumnEnums.BS_AutoPartsName.Code.APN_ID].Value);
            if (DetailDS == null || string.IsNullOrEmpty(DetailDS.APN_ID))
            {
                return;
            }

            if (txtAPN_ID.Text != DetailDS.APN_ID ||
                (txtAPN_ID.Text == DetailDS.APN_ID && txtAPN_VersionNo.Text != DetailDS.APN_VersionNo?.ToString()))
            {
                if (txtAPN_ID.Text == DetailDS.APN_ID && txtAPN_VersionNo.Text != DetailDS.APN_VersionNo?.ToString())
                {
                    //数据版本已过期,将加载最新详情。
                    MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.I_0000, new object[] { MsgParam.DataHasOverdue }), MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
                else if (ViewHasChanged())
                {
                    //将放弃之前的修改,是否继续?
                    DialogResult dialogResult = MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.I_0000, new object[] { MsgParam.ConfirmGiveUpEdit }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (dialogResult != DialogResult.OK)
                    {
                        //选中【详情】Tab
                        tabControlFull.Tabs[SysConst.EN_DETAIL].Selected = true;
                        return;
                    }
                }
                //将DetailDS数据赋值给【详情】Tab内的对应控件
                SetDetailDSToCardCtrls();
            }

            //选中【详情】Tab
            tabControlFull.Tabs[SysConst.EN_DETAIL].Selected = true;

            //将最新的值Copy到初始UIModel
            this.AcceptUIModelChanges();
        }
Beispiel #6
0
 //Metodo que llama al Callback para actualizar el GridPageSizeDS y el GridDS
 protected void GridDS_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
 {
     GridPageSizeDS = int.Parse(e.Parameters);
     GridDS.SettingsPager.PageSize = GridPageSizeDS;
     GridDS.DataBind();
     GridDS.Settings.VerticalScrollableHeight = 280;
     GridDS.Settings.VerticalScrollBarMode    = ScrollBarMode.Visible;
 }
Beispiel #7
0
 //Método que limpia los filtros del GridDS
 protected void lkb_LimpiarFiltrosDS_Click(object sender, EventArgs e)
 {
     foreach (GridViewColumn column in GridDS.Columns)
     {
         if (column is GridViewDataColumn)
         {
             ((GridViewDataColumn)column).Settings.AutoFilterCondition = AutoFilterCondition.Default;
             GridDS.AutoFilterByColumn(column, "");
             GridDS.FilterExpression = String.Empty;
             GridDS.ClearSort();
         }
     }
 }
        /// <summary>
        /// 充值
        /// </summary>
        public override void WalletDepositMoney()
        {
            //待充值的钱包
            WalletInfoUIModel walletToDeposit = new WalletInfoUIModel();

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                //选中【详情】Tab的场合
                _bll.CopyModel(DetailDS, walletToDeposit);
            }
            else
            {
                //选中【列表】Tab的场合
                gdGrid.UpdateData();

                var selectedWalletList = GridDS.Where(x => x.IsChecked == true).ToList();
                if (selectedWalletList.Count == 0 || selectedWalletList.Count > 1)
                {
                    //请选择一个钱包进行充值
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0006, new object[] { MsgParam.ONE + SystemTableEnums.Name.EWM_Wallet, SystemNavigateEnum.Name.DEPOSITMONEY }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    for (int i = 0; i < selectedWalletList.Count; i++)
                    {
                        if (i != 0)
                        {
                            selectedWalletList[i].IsChecked = false;
                        }
                        gdGrid.DataSource = GridDS;
                        gdGrid.DataBind();
                    }
                    return;
                }
                _bll.CopyModel(selectedWalletList[0], walletToDeposit);
            }

            if (string.IsNullOrEmpty(walletToDeposit.Wal_ID) ||
                string.IsNullOrEmpty(walletToDeposit.Wal_No))
            {
                //没有获取到钱包,充值失败
                MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { MsgParam.WALLET, SystemActionEnum.Name.RECHARGE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Dictionary <string, object> paramViewParameters = new Dictionary <string, object>
            {
                //钱包相关信息
                { RIAViewParamKey.WalletInfo.ToString(), walletToDeposit },
            };

            //跳转到[钱包充值]
            SystemFunction.ShowViewFromView(MsgParam.WALLET_DEPOSITMONEY, ViewClassFullNameConst.RIA_FrmWalletDepositMoney, true, PageDisplayMode.TabPage, paramViewParameters, null);
        }
        /// <summary>
        /// 刷新列表
        /// </summary>
        private void RefreshList()
        {
            var curHead = GridDS.FirstOrDefault(x => x.ASAH_ID == DetailDS.ASAH_ID);

            if (curHead != null)
            {
                _bll.CopyModel(DetailDS, curHead);
            }
            else
            {
                GridDS.Insert(0, DetailDS);
            }

            gdGrid.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows);
        }
Beispiel #10
0
 /// <summary>
 /// show all tables of the current database
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void linkShowTables_Click(object sender, EventArgs e)
 {
     try
     {
         var ds =
             ExportHelper.ReturnDataSet(
                 "SELECT table_name AS Name FROM INFORMATION_SCHEMA.Tables WHERE (TABLE_TYPE = 'BASE TABLE') Order By table_name");
         if (ds != null)
         {
             GridDS.DataSource = ds;
             GridDS.DataBind();
         }
     }
     catch (Exception ex)
     {
         Skin.AddModuleMessage(this, "Error In Getting Tables: " + ex.Message,
                               ModuleMessage.ModuleMessageType.RedError);
     }
 }
Beispiel #11
0
        /// <summary>
        /// 刷新列表
        /// </summary>
        /// <param name="paramIsDelete">是否是删除操作</param>
        private void RefreshList(bool paramIsDelete = false)
        {
            if (paramIsDelete)
            {
                if (tabControlFull.Tabs[SysConst.EN_LIST].Selected)
                {
                    var removeList = _detailGridDS.Where(x => x.IsChecked == true).ToList();
                    foreach (var loopRemove in removeList)
                    {
                        _detailGridDS.Remove(loopRemove);
                    }
                }
                else
                {
                    var curHead = GridDS.FirstOrDefault(x => x.SI_ID == DetailDS.SI_ID);
                    if (curHead != null)
                    {
                        _detailGridDS.Remove(curHead);
                    }
                }
            }
            else
            {
                if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
                {
                    var curHead = _detailGridDS.FirstOrDefault(x => x.SI_ID == DetailDS.SI_ID);
                    if (curHead != null)
                    {
                        _bll.CopyModel(DetailDS, curHead);
                    }
                    else
                    {
                        _detailGridDS.Insert(0, DetailDS);
                    }
                }
            }

            gdGrid.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows);
        }
Beispiel #12
0
        protected void lkb_ActualizarDS_Click(object sender, EventArgs e)
        {
            try
            {
                string mensaje = string.Empty;
                Session["DS"] = exp.Consulta_DATA_STAGE(lblCadena.Text, ref mensaje);

                GridDS.DataSource = Session["DS"];
                GridDS.DataBind();
                GridDS.Settings.VerticalScrollableHeight = 280;
                GridDS.Settings.VerticalScrollBarMode    = ScrollBarMode.Visible;
            }
            catch (Exception ex)
            {
                string mensaje   = string.Empty;
                int    idusuario = 0;
                if (Session["IdUsuario"] != null)
                {
                    idusuario = int.Parse(Session["IdUsuario"].ToString());
                }
                excepcion.RegistrarExcepcion(idusuario, "DescargaExpediente-lkb_ActualizarDS_Click", ex, lblCadena.Text, ref mensaje);
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        public override void DeleteAction()
        {
            #region 验证删除
            //待删除的配件名称列表
            List <MDLBS_AutoPartsName> deleteAutoPartsNameList = new List <MDLBS_AutoPartsName>();
            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                #region 详情删除
                if (string.IsNullOrEmpty(txtAPN_ID.Text))
                {
                    //配件名称信息为空,不能删除
                    MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableColumnEnums.BS_AutoPartsName.Name.APN_Name, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //验证配件名称是否被引用过
                List <MDLBS_AutoPartsArchive> usedAutoPartsNameList = new List <MDLBS_AutoPartsArchive>();
                _bll.QueryForList(SQLID.BS_AutoPartsNameManager_SQL03, txtAPN_Name.Text + SysConst.Semicolon_DBC, usedAutoPartsNameList);
                if (usedAutoPartsNameList.Count > 0)
                {
                    //配件名称已经被使用,不能删除
                    MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { txtAPN_Name.Text, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //确认删除
                DialogResult dialogResult = MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0012), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }

                MDLBS_AutoPartsName deleteAutoPartsName = new MDLBS_AutoPartsName()
                {
                    WHERE_APN_ID = txtAPN_ID.Text.Trim(),
                };
                deleteAutoPartsNameList.Add(deleteAutoPartsName);
                #endregion
            }
            else
            {
                #region 列表删除
                gdGrid.UpdateData();
                var checkedAutoPartsNameList = GridDS.Where(p => p.IsChecked == true).ToList();
                if (checkedAutoPartsNameList.Count == 0)
                {
                    //请勾选至少一条配件名称信息进行删除
                    MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableColumnEnums.BS_AutoPartsName.Name.APN_Name, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                string autoPartsNameStr = string.Empty;
                foreach (var loopCheckedAutoPartsName in checkedAutoPartsNameList)
                {
                    if (string.IsNullOrEmpty(loopCheckedAutoPartsName.APN_Name))
                    {
                        continue;
                    }
                    autoPartsNameStr += loopCheckedAutoPartsName.APN_Name + SysConst.Semicolon_DBC;
                }
                //验证配件名称是否被引用过
                List <MDLBS_AutoPartsArchive> usedAutoPartsNameList = new List <MDLBS_AutoPartsArchive>();
                _bll.QueryForList(SQLID.BS_AutoPartsNameManager_SQL03, autoPartsNameStr, usedAutoPartsNameList);
                if (usedAutoPartsNameList.Count > 0)
                {
                    string usedAutoPartsNameStr = string.Empty;
                    foreach (var loopName in usedAutoPartsNameList)
                    {
                        if (string.IsNullOrEmpty(loopName.APA_Name))
                        {
                            continue;
                        }
                        usedAutoPartsNameStr += loopName.APA_Name + SysConst.Comma_DBC;
                    }
                    //配件名称已经被使用,不能删除
                    MessageBoxs.Show(Trans.BS, this.ToString(),
                                     MsgHelp.GetMsg(MsgCode.W_0007,
                                                    new object[] { usedAutoPartsNameStr, MsgParam.APPLY, SystemActionEnum.Name.DELETE }),
                                     MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //已选checkedAutoPartsNameList.Count 条数据,确定删除?\r\n单击【确定】删除,【取消】返回。
                DialogResult dialogResult = MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.W_0013, new object[] { checkedAutoPartsNameList.Count }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }
                _bll.CopyModelList(checkedAutoPartsNameList, deleteAutoPartsNameList);
                foreach (var loopDeleteAutoPartsName in deleteAutoPartsNameList)
                {
                    loopDeleteAutoPartsName.WHERE_APN_ID = loopDeleteAutoPartsName.APN_ID;
                }
                #endregion
            }

            #endregion

            #region  除数据
            if (deleteAutoPartsNameList.Count > 0)
            {
                var deleteAutoPartsNameResult = _bll.DeleteAutoPartsName(deleteAutoPartsNameList);
                if (!deleteAutoPartsNameResult)
                {
                    //删除失败
                    MessageBoxs.Show(Trans.BS, ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //删除成功
                MessageBoxs.Show(Trans.BS, ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            #endregion

            //3.清空【详情】画面数据
            InitializeDetailTabControls();
            //刷新列表
            RefreshList(true);

            //将最新的值Copy到初始UIModel
            SetCardCtrlsToDetailDS();
            this.AcceptUIModelChanges();
        }
        /// <summary>
        /// 删除
        /// </summary>
        public override void DeleteAction()
        {
            #region 准备数据
            //待删除的车辆品牌车系列表
            List <MDLBS_VehicleBrandInspireSumma> deleteVehicleBrandInspireList = new List <MDLBS_VehicleBrandInspireSumma>();

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                #region 详情删除
                if (string.IsNullOrEmpty(txtVBIS_ID.Text))
                {
                    MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableEnums.Name.BS_VehicleBrandInspireSumma, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //验证品牌车系是否被引用过
                List <MDLBS_AutoPartsArchive> usedBrandAndInspireList = new List <MDLBS_AutoPartsArchive>();
                _bll.QueryForList(SQLID.BS_VehicleBrandInspireSummaManager_SQL02, new MDLBS_VehicleBrandInspireSumma
                {
                    WHERE_VBIS_Brand   = mcbVBIS_Brand.SelectedValue + SysConst.Semicolon_DBC,
                    WHERE_VBIS_Inspire = mcbVBIS_Inspire.SelectedValue + SysConst.Semicolon_DBC,
                }, usedBrandAndInspireList);
                if (usedBrandAndInspireList.Count > 0)
                {
                    //品牌车系已经被使用,不能删除
                    MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { mcbVBIS_Brand.SelectedText + SysConst.Comma_DBC + mcbVBIS_Inspire.SelectedText, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //确认删除
                DialogResult dialogResult = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0012), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }
                //待删除的车辆品牌车系
                MDLBS_VehicleBrandInspireSumma vehicleBrandInspireToDelete = new MDLBS_VehicleBrandInspireSumma
                {
                    WHERE_VBIS_ID = txtVBIS_ID.Text.Trim(),
                    VBIS_Brand    = mcbVBIS_Brand.SelectedValue,
                    VBIS_Inspire  = mcbVBIS_Inspire.SelectedValue,
                };
                deleteVehicleBrandInspireList.Add(vehicleBrandInspireToDelete);
                #endregion
            }
            else
            {
                #region 列表删除
                gdGrid.UpdateData();
                //勾选的品牌车系列表
                List <VehicleBrandInspireSummaManagerUIModel> checkedVehicleBrandInspireList = GridDS.Where(x => x.IsChecked == true).ToList();
                if (checkedVehicleBrandInspireList.Count == 0)
                {
                    MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableEnums.Name.BS_VehicleBrandInspireSumma, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //验证品牌车系是否被引用过
                string vehicleBrandStr   = string.Empty;
                string vehicleInspireStr = string.Empty;
                foreach (var loopVehicleBrandInspire in checkedVehicleBrandInspireList)
                {
                    if (string.IsNullOrEmpty(loopVehicleBrandInspire.VBIS_Brand) ||
                        string.IsNullOrEmpty(loopVehicleBrandInspire.VBIS_Inspire))
                    {
                        continue;
                    }
                    vehicleBrandStr   += loopVehicleBrandInspire.VBIS_Brand + SysConst.Semicolon_DBC;
                    vehicleInspireStr += loopVehicleBrandInspire.VBIS_Inspire + SysConst.Semicolon_DBC;
                }
                List <MDLBS_AutoPartsArchive> usedBrandAndInspireList = new List <MDLBS_AutoPartsArchive>();
                _bll.QueryForList(SQLID.BS_VehicleBrandInspireSummaManager_SQL02, new MDLBS_VehicleBrandInspireSumma
                {
                    WHERE_VBIS_Brand   = vehicleBrandStr,
                    WHERE_VBIS_Inspire = vehicleInspireStr,
                }, usedBrandAndInspireList);
                if (usedBrandAndInspireList.Count > 0)
                {
                    string usedBrandstring = string.Empty;
                    foreach (var loopBrandAndInspire in usedBrandAndInspireList)
                    {
                        if (string.IsNullOrEmpty(loopBrandAndInspire.APA_VehicleBrand))
                        {
                            continue;
                        }
                        usedBrandstring += loopBrandAndInspire.APA_VehicleBrand + SysConst.Comma_DBC;
                    }
                    //品牌车系已经被使用,不能删除
                    MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { usedBrandstring, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //确认删除
                DialogResult dialogResult = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0013, new object[] { checkedVehicleBrandInspireList.Count }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }
                foreach (var loopCheckedVehicleBrandInspire in checkedVehicleBrandInspireList)
                {
                    if (string.IsNullOrEmpty(loopCheckedVehicleBrandInspire.VBIS_ID))
                    {
                        continue;
                    }

                    //待删除的车辆品牌车系
                    MDLBS_VehicleBrandInspireSumma vehicleBrandInspireToDelete = new MDLBS_VehicleBrandInspireSumma
                    {
                        WHERE_VBIS_ID = loopCheckedVehicleBrandInspire.VBIS_ID,
                        VBIS_Brand    = loopCheckedVehicleBrandInspire.VBIS_Brand,
                        VBIS_Inspire  = loopCheckedVehicleBrandInspire.VBIS_Inspire,
                    };
                    deleteVehicleBrandInspireList.Add(vehicleBrandInspireToDelete);
                }
                #endregion
            }
            #endregion

            #region  除数据
            if (deleteVehicleBrandInspireList.Count > 0)
            {
                var deleteResult = _bll.DeleteVehicleBrandInspire(deleteVehicleBrandInspireList);
                if (!deleteResult)
                {
                    //删除失败
                    MessageBoxs.Show(Trans.BS, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                //删除成功
                MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            #endregion

            //3.清空【详情】画面数据
            InitializeDetailTabControls();
            //刷新列表
            RefreshList(true);

            //将最新的值Copy到初始UIModel
            SetCardCtrlsToDetailDS();
            this.AcceptUIModelChanges();
        }
        /// <summary>
        /// 销户
        /// </summary>
        public override void CloseAccountAction()
        {
            //当前钱包
            WalletQueryAndOperateUIModel curWallet = new WalletQueryAndOperateUIModel();

            #region 验证以及准备数据

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                #region 详情销户

                if (string.IsNullOrEmpty(DetailDS.Wal_ID) ||
                    string.IsNullOrEmpty(DetailDS.Wal_No))
                {
                    //没有获取到钱包,销户失败
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { SystemTableEnums.Name.EWM_Wallet, SystemActionEnum.Name.CLOSEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                #endregion

                curWallet = DetailDS;
            }
            else
            {
                #region 列表销户

                gdGrid.UpdateData();

                var checkedWallet = GridDS.Where(x => x.IsChecked == true).ToList();
                if (checkedWallet.Count != 1)
                {
                    //请勾选一个钱包销户!
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { "请勾选一个钱包销户!" }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (string.IsNullOrEmpty(checkedWallet[0].Wal_ID) ||
                    string.IsNullOrEmpty(checkedWallet[0].Wal_No))
                {
                    //没有获取到钱包,销户失败
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { SystemTableEnums.Name.EWM_Wallet, SystemActionEnum.Name.CLOSEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                curWallet = checkedWallet[0];

                #endregion
            }

            //判断钱包有无应收款
            var noSettleBill = BLLCom.GetNoSettleBillByCustomerID(curWallet.Wal_CustomerID);
            if (noSettleBill.Count > 0)
            {
                MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { "钱包的开户人还有未结算的单据,请先收款" }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (curWallet.Wal_AvailableBalance > 0)
            {
                MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { "该钱包余额大于零,请提现后销户" }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //提示信息
            string warningMessage = "您是否需要销户?\n";
            warningMessage += "钱包账号:" + curWallet.Wal_No + "\n";
            warningMessage += "开户组织:" + curWallet.Wal_CreatedByOrgName + "\n";
            warningMessage += "开户人:" + curWallet.Wal_CustomerName + "\n";
            warningMessage += "可用余额:" + curWallet.Wal_AvailableBalance + "\n";
            //弹提示框
            DialogResult dialogResult = MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, warningMessage), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (dialogResult != DialogResult.OK)
            {
                return;
            }
            #endregion

            #region 保存数据

            bool closeAccountResult = _bll.CloseAccountDetailDS(curWallet);
            if (!closeAccountResult)
            {
                //销户失败
                MessageBoxs.Show(Trans.RIA, ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //销户成功
            MessageBoxs.Show(Trans.RIA, ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.CLOSEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information);

            #endregion

            //刷新列表
            RefreshList();

            //4.将DetailDS数据赋值给【详情】Tab内的对应控件
            SetDetailDSToCardCtrls();
            //将最新的值Copy到初始UIModel
            this.AcceptUIModelChanges();

            //设置详情页面控件以及导航按钮是否可编辑
            SetDetailControl();
        }
        /// <summary>
        /// 提现
        /// </summary>
        public override void WithdrawCashAction()
        {
            //当前钱包
            MDLEWM_Wallet curWallet = new MDLEWM_Wallet();
            string        walletNo  = string.Empty;

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                #region 详情提现

                if (string.IsNullOrEmpty(DetailDS.Wal_ID) ||
                    string.IsNullOrEmpty(DetailDS.Wal_No))
                {
                    //没有获取到钱包,提现失败
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { SystemTableEnums.Name.EWM_Wallet, SystemActionEnum.Name.WITHDRAWCASH }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                #endregion

                walletNo = DetailDS.Wal_No;
                _bll.CopyModel(DetailDS, curWallet);
            }
            else
            {
                #region 列表提现

                gdGrid.UpdateData();

                var checkedWallet = GridDS.Where(x => x.IsChecked == true).ToList();
                if (checkedWallet.Count != 1)
                {
                    //请勾选一个钱包提现!
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { "请勾选一个钱包提现!" }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (string.IsNullOrEmpty(checkedWallet[0].Wal_ID) ||
                    string.IsNullOrEmpty(checkedWallet[0].Wal_No))
                {
                    //没有获取到钱包,提现失败
                    MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { SystemTableEnums.Name.EWM_Wallet, SystemActionEnum.Name.WITHDRAWCASH }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                walletNo = checkedWallet[0].Wal_No;
                _bll.CopyModel(checkedWallet[0], curWallet);

                #endregion
            }

            string argsResultMessage = string.Empty;
            string argsNewWalletNo   = string.Empty;
            bool   validateResult    = BLLCom.ValidateWallet(WalTransTypeEnum.Name.TX, 0, string.Empty,
                                                             walletNo, string.Empty, string.Empty, string.Empty, ref argsResultMessage, ref argsNewWalletNo, ref curWallet);
            if (!validateResult)
            {
                MessageBoxs.Show(Trans.RIA, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0000, new object[] { argsResultMessage }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            WalletWithdrawalUIModel withdrawalWallet = new WalletWithdrawalUIModel();
            _bll.CopyModel(curWallet, withdrawalWallet);

            Dictionary <string, object> paramViewParameters = new Dictionary <string, object>
            {
                //操作参数Key
                { ComViewParamKey.EnumKeyOperation.ToString(), Operation.Show },
                //新打开界面的Model
                { ComViewParamKey.DestModel.ToString(), withdrawalWallet }
            };

            FrmWalletWithdrawalDialogWindow frmWalletWithdrawalDialogWindow = new FrmWalletWithdrawalDialogWindow(paramViewParameters)
            {
                StartPosition = FormStartPosition.CenterScreen
            };
            DialogResult dialogResult = frmWalletWithdrawalDialogWindow.ShowDialog();

            if (dialogResult != DialogResult.OK)
            {
                return;
            }

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                _bll.CopyModel(withdrawalWallet, DetailDS);
                //刷新列表
                RefreshList();
            }
            else
            {
                var curHead = GridDS.FirstOrDefault(x => x.Wal_ID == withdrawalWallet.Wal_ID);
                if (curHead != null)
                {
                    _bll.CopyModel(withdrawalWallet, curHead);
                }
            }

            SetDetailDSToCardCtrls();
            //将最新的值Copy到初始UIModel
            this.AcceptUIModelChanges();
        }
        /// <summary>
        /// 删除
        /// </summary>
        public override void DeleteAction()
        {
            //2.执行删除
            #region 准备数据

            //待删除的码表列表
            List <MDLSM_CodeTable> deleteCodeTableList = new List <MDLSM_CodeTable>();

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                #region 详情删除
                if (string.IsNullOrEmpty(txtCT_ID.Text))
                {
                    //码表信息为空,不能删除
                    MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableEnums.Name.SM_CodeTable, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //查询[码表]是否被引用过
                var usedCount = 0;
                _bll.QueryForObject <Int32>(SQLID.BS_CodeTableManager_SQL03, new MDLSM_CodeTable
                {
                    WHERE_CT_Type = cbCT_Type.Text.Trim(),
                    WHERE_CT_Name = txtCT_Name.Text.Trim()
                });
                if (usedCount > 0)
                {
                    MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0003, new object[] { SystemTableEnums.Name.SM_CodeTable }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //确认删除操作
                DialogResult dialogResult = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0012), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }
                //待删除的码表
                MDLSM_CodeTable deleteCodeTable = new MDLSM_CodeTable
                {
                    WHERE_CT_ID = txtCT_ID.Text.Trim()
                };
                deleteCodeTableList.Add(deleteCodeTable);
                #endregion
            }
            else
            {
                #region 列表删除
                gdGrid.UpdateData();
                //勾选的码表列表
                List <CodeTableManagerUIModel> checkedCodeTableList = GridDS.Where(x => x.IsChecked == true).ToList();
                if (checkedCodeTableList.Count == 0)
                {
                    MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableEnums.Name.SM_CodeTable, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                #region 查询码表是否被引用过
                //勾选的[码表]列表中已被引用的[码表]列表
                List <CodeTableManagerUIModel> checkedUsedList = new List <CodeTableManagerUIModel>();

                foreach (var loopCodeTable in checkedCodeTableList)
                {
                    var resultUsedCount = _bll.QueryForObject <Int32>(SQLID.BS_CodeTableManager_SQL03, new MDLSM_CodeTable
                    {
                        WHERE_CT_Type = loopCodeTable.CT_Type,
                        WHERE_CT_Name = loopCodeTable.CT_Name
                    });
                    if (resultUsedCount > 0)
                    {
                        loopCodeTable.IsChecked = false;
                        checkedUsedList.Add(loopCodeTable);
                    }
                }

                if (checkedUsedList.Count > 0)
                {
                    //勾选的列表中包含已被引用的[码表],是否忽略
                    DialogResult continueDelete = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0026, new object[] { }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (continueDelete != DialogResult.OK)
                    {
                        foreach (var loopCheckedUsed in checkedUsedList)
                        {
                            loopCheckedUsed.IsChecked = false;
                        }
                        gdGrid.DataSource = GridDS;
                        gdGrid.DataBind();
                        return;
                    }
                    checkedCodeTableList.RemoveAll(x => x.IsChecked == false);

                    gdGrid.DataSource = GridDS;
                    gdGrid.DataBind();
                }
                else
                {
                    //勾选的列表中不包含已被引用的[码表]
                    //确认删除操作
                    DialogResult confirmDeleteResult = MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0013, new object[] { checkedCodeTableList.Count }), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (confirmDeleteResult != DialogResult.OK)
                    {
                        return;
                    }
                }
                #endregion

                foreach (var loopCheckedCodeTable in checkedCodeTableList)
                {
                    if (string.IsNullOrEmpty(loopCheckedCodeTable.CT_ID))
                    {
                        continue;
                    }

                    //待删除的码表
                    MDLSM_CodeTable deleteCodeTable = new MDLSM_CodeTable
                    {
                        WHERE_CT_ID = loopCheckedCodeTable.CT_ID
                    };
                    deleteCodeTableList.Add(deleteCodeTable);
                }
                #endregion
            }

            #endregion

            #region  除数据
            if (deleteCodeTableList.Count > 0)
            {
                var deleteCodeTableResult = _bll.DeleteCodeTable(deleteCodeTableList);
                if (!deleteCodeTableResult)
                {
                    //删除失败
                    MessageBoxs.Show(Trans.BS, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                //删除成功
                MessageBoxs.Show(Trans.BS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            #endregion

            //3.清空【详情】画面数据
            InitializeDetailTabControls();
            //刷新列表
            RefreshList(true);

            //将最新的值Copy到初始UIModel
            SetCardCtrlsToDetailDS();
            this.AcceptUIModelChanges();
        }
Beispiel #18
0
        /// <summary>
        /// 开户
        /// </summary>
        public override void WalletCreateAccount()
        {
            //待开户的客户
            CustomerQueryUIModel customerToCreateAccount = new CustomerQueryUIModel();

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                //选中【详情】Tab的场合
                //验证该客户是否已开户
                List <WalletInfoUIModel> resultWalletList = BLLCom.GetWalletListByOwnerInfo(CustomerTypeEnum.Name.PTKH, DetailDS.GC_ID);
                if (resultWalletList.Count > 0)
                {
                    //该客户已开户
                    MessageBoxs.Show(Trans.PIS, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, new object[] { "客户:" + DetailDS.GC_Name + "已开户!" }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                customerToCreateAccount.CustomerID   = DetailDS.GC_ID;
                customerToCreateAccount.CustomerName = DetailDS.GC_Name;
                customerToCreateAccount.CustomerType = CustomerTypeEnum.Name.PTKH;
            }
            else
            {
                //选中【列表】Tab的场合
                gdGrid.UpdateData();

                var selectedCustomerList = GridDS.Where(x => x.IsChecked == true).ToList();
                if (selectedCustomerList.Count == 0 || selectedCustomerList.Count > 1)
                {
                    //请选择一个普通客户进行开户
                    MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0006, new object[] { MsgParam.ONE + SystemTableEnums.Name.PIS_GeneralCustomer, SystemNavigateEnum.Name.CREATEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    for (int i = 0; i < selectedCustomerList.Count; i++)
                    {
                        if (i != 0)
                        {
                            selectedCustomerList[i].IsChecked = false;
                        }
                        gdGrid.DataSource = GridDS;
                        gdGrid.DataBind();
                    }
                    return;
                }
                //验证该客户是否已开户
                List <WalletInfoUIModel> resultWalletList = BLLCom.GetWalletListByOwnerInfo(CustomerTypeEnum.Name.PTKH, selectedCustomerList[0].GC_ID);
                if (resultWalletList.Count > 0)
                {
                    //该客户已开户
                    MessageBoxs.Show(Trans.PIS, ToString(), MsgHelp.GetMsg(MsgCode.E_0000, new object[] { "客户:" + selectedCustomerList[0].GC_Name + "已开户!" }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    selectedCustomerList[0].IsChecked = false;
                    gdGrid.DataSource = GridDS;
                    gdGrid.DataBind();
                    return;
                }
                customerToCreateAccount.CustomerID   = selectedCustomerList[0].GC_ID;
                customerToCreateAccount.CustomerName = selectedCustomerList[0].GC_Name;
                customerToCreateAccount.CustomerType = CustomerTypeEnum.Name.PTKH;
            }

            if (string.IsNullOrEmpty(customerToCreateAccount.CustomerID) ||
                string.IsNullOrEmpty(customerToCreateAccount.CustomerName))
            {
                //没有获取到客户,开户失败
                MessageBoxs.Show(Trans.PIS, ToString(), MsgHelp.GetMsg(MsgCode.W_0024, new object[] { SystemTableEnums.Name.PIS_GeneralCustomer, SystemNavigateEnum.Name.CREATEACCOUNT }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Dictionary <string, object> paramViewParameters = new Dictionary <string, object>
            {
                //客户信息
                { ComViewParamKey.CustomerInfo.ToString(), customerToCreateAccount },
            };

            //跳转到[钱包开户]
            SystemFunction.ShowViewFromView(MsgParam.WALLET_CREATEACCOUNT, ViewClassFullNameConst.RIA_FrmWalletCreateAccount, true, PageDisplayMode.TabPage, paramViewParameters, null);
        }
Beispiel #19
0
        /// <summary>
        /// 删除
        /// </summary>
        public override void DeleteAction()
        {
            //2.执行删除
            #region 准备数据

            //待删除的[普通客户]列表
            List <MDLPIS_GeneralCustomer> deleteGeneralCustomerList = new List <MDLPIS_GeneralCustomer>();

            if (tabControlFull.Tabs[SysConst.EN_DETAIL].Selected)
            {
                #region 详情删除
                if (string.IsNullOrEmpty(txtGC_ID.Text))
                {
                    //普通客户信息为空,不能删除
                    MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0016, new object[] { SystemTableEnums.Name.PIS_GeneralCustomer, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                #region 验证普通客户是否已被使用

                if (!string.IsNullOrEmpty(txtGC_ID.Text.Trim()))
                {
                    //验证普通客户是否已被使用
                    StringBuilder customerIDs = new StringBuilder();
                    customerIDs.Append(SysConst.Semicolon_DBC + txtGC_ID.Text + SysConst.Semicolon_DBC);
                    //查询普通客户是否被引用过
                    List <MDLPIS_GeneralCustomer> generalCustomerList = new List <MDLPIS_GeneralCustomer>();
                    _bll.QueryForList(SQLID.PIS_GeneralCustomerManager_SQL02, new MDLPIS_GeneralCustomer
                    {
                        WHERE_GC_ID = customerIDs.ToString()
                    }, generalCustomerList);
                    if (generalCustomerList.Count > 0)
                    {
                        MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { txtGC_Name.Text.Trim(), MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }

                #endregion

                //确认删除操作
                DialogResult dialogResult = MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0012), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dialogResult != DialogResult.OK)
                {
                    return;
                }
                //待删除的普通客户
                MDLPIS_GeneralCustomer deleteGeneralCustomer = new MDLPIS_GeneralCustomer
                {
                    WHERE_GC_ID = txtGC_ID.Text.Trim()
                };
                deleteGeneralCustomerList.Add(deleteGeneralCustomer);
                #endregion
            }
            else
            {
                #region 列表删除
                gdGrid.UpdateData();
                //勾选的普通客户列表
                List <GeneralCustomerManagerUIModel> checkedGeneralCustomerList = GridDS.Where(x => x.IsChecked == true).ToList();
                if (checkedGeneralCustomerList.Count == 0)
                {
                    MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0017, new object[] { SystemTableEnums.Name.PIS_GeneralCustomer, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                #region 验证普通客户是否已被使用

                //验证普通客户是否已被使用
                StringBuilder customerIDs = new StringBuilder();
                customerIDs.Append(SysConst.Semicolon_DBC);
                foreach (var loopSelectedItem in checkedGeneralCustomerList)
                {
                    customerIDs.Append(loopSelectedItem.GC_ID + SysConst.Semicolon_DBC);
                }
                //查询普通客户是否被引用过
                List <MDLPIS_GeneralCustomer> generalCustomerList = new List <MDLPIS_GeneralCustomer>();
                _bll.QueryForList(SQLID.PIS_GeneralCustomerManager_SQL02, new MDLPIS_GeneralCustomer
                {
                    WHERE_GC_ID = customerIDs.ToString()
                }, generalCustomerList);
                if (generalCustomerList.Count > 0)
                {
                    StringBuilder customerName = new StringBuilder();
                    int           i            = 0;
                    foreach (var loopWarehouse in generalCustomerList)
                    {
                        i++;
                        if (i == 1)
                        {
                            customerName.Append(loopWarehouse.GC_Name);
                        }
                        else
                        {
                            customerName.Append(SysConst.Comma_DBC + loopWarehouse.GC_Name);
                        }
                    }
                    //普通客户已经被使用,不能删除
                    MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.W_0007, new object[] { customerName, MsgParam.APPLY, SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                #endregion

                foreach (var loopCheckedGeneralCustomer in checkedGeneralCustomerList)
                {
                    if (string.IsNullOrEmpty(loopCheckedGeneralCustomer.GC_ID))
                    {
                        continue;
                    }

                    //待删除的普通客户
                    MDLPIS_GeneralCustomer deleteGeneralCustomer = new MDLPIS_GeneralCustomer
                    {
                        WHERE_GC_ID = loopCheckedGeneralCustomer.GC_ID
                    };
                    deleteGeneralCustomerList.Add(deleteGeneralCustomer);
                }
                #endregion
            }

            #endregion

            #region  除数据
            if (deleteGeneralCustomerList.Count > 0)
            {
                var deleteGeneralCustomerResult = _bll.DeleteGeneralCustomer(deleteGeneralCustomerList);
                if (!deleteGeneralCustomerResult)
                {
                    //删除失败
                    MessageBoxs.Show(Trans.PIS, this.ToString(), _bll.ResultMsg, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                //删除成功
                MessageBoxs.Show(Trans.PIS, this.ToString(), MsgHelp.GetMsg(MsgCode.I_0001, new object[] { SystemActionEnum.Name.DELETE }), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            #endregion

            //3.清空【详情】画面数据
            InitializeDetailTabControls();
            //刷新列表
            RefreshList(true);

            //4.将DetailDS数据赋值给【详情】Tab内的对应控件
            SetDetailDSToCardCtrls();
            //将最新的值Copy到初始UIModel
            this.AcceptUIModelChanges();
        }
Beispiel #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Session["Cadena"] == null)
                {
                    //string alerta = "<script>alert('La sesión ha expirado, debe volver a iniciar sesión');window.location.href='Login.aspx'</script>";
                    //Response.Write(alerta);
                    Session["Tab"] = "Salir";
                    Response.Redirect("Login.aspx", false);
                    return;
                }
                else
                {
                    lblCadena.Text = Session["Cadena"].ToString();
                    Session["Tab"] = "Inicio";
                }

                if (!Page.IsPostBack)
                {
                    nombreArchivo = Request.Path.Substring(Request.Path.LastIndexOf("/") + 1);
                    if (Session["Permisos"] != null)
                    {
                        DataTable dt = ((DataTable)Session["Permisos"]).Select("Archivo like '%" + nombreArchivo + "%'").CopyToDataTable();
                        tituloPagina     = dt.Rows[0]["NombreModulo"].ToString();
                        permisoConsultar = Convert.ToBoolean(Convert.ToInt32(dt.Rows[0]["Consultar"].ToString()));
                        if (!permisoConsultar)
                        {
                            Response.Redirect("Default.aspx");
                        }
                        permisoExportar = Convert.ToBoolean(Convert.ToInt32(dt.Rows[0]["Exportar"].ToString()));
                        Page.Title      = tituloPagina;
                    }

                    Session["GridED"] = null;
                    TituloPanel(string.Empty);
                    RANGO.Text = DESDE.Text = HASTA.Text = string.Empty;

                    DataTable dtGrid = new DataTable();
                    GridED.DataSource = dtGrid;
                    GridED.DataBind();
                    GridED.Settings.VerticalScrollableHeight = 280;
                    GridED.Settings.VerticalScrollBarMode    = ScrollBarMode.Visible;

                    InhabilitarBotonDescarga();

                    string    mensaje = "";
                    DataTable dta     = new DataTable();
                    dta = catalogo.TraerAduanas(lblCadena.Text, ref mensaje);
                    cmbADUANA.DataSource = dta;
                    cmbADUANA.DataBind();

                    //Trae en una sesion la tabla de datastage
                    mensaje           = string.Empty;
                    Session["DS"]     = exp.Consulta_DATA_STAGE(lblCadena.Text, ref mensaje);
                    GridDS.DataSource = Session["DS"];
                    GridDS.DataBind();
                    GridDS.Settings.VerticalScrollableHeight = 280;
                    GridDS.Settings.VerticalScrollBarMode    = ScrollBarMode.Visible;
                }
            }
            catch (Exception ex)
            {
                string mensaje   = string.Empty;
                int    idusuario = 0;
                if (Session["IdUsuario"] != null)
                {
                    idusuario = int.Parse(Session["IdUsuario"].ToString());
                }
                excepcion.RegistrarExcepcion(idusuario, "Page_Load", ex, lblCadena.Text, ref mensaje);
                if (mensaje.Length == 0)
                {
                    mensaje = "Error: " + excepcion.SerializarExMessage(lblCadena.Text, ex);
                }
                //Response.Redirect("Login.aspx");
            }
        }