Ejemplo n.º 1
0
        private void GetMachineList(string mcType)
        {
            List <Machine> lstMachine = null;

            try
            {
                base.ExecutionStart();
                base.BeginProcessing("Begin Load data...", "Please Waiting for Loading Data");

                using (MachineBLL mcBll = new MachineBLL())
                {
                    lstMachine = mcBll.GetMachineList(mcType);
                }

                this.grdMachine.DataSource = lstMachine;
                this.dntMachine.DataSource = lstMachine;

                this.chkSelect.ClearSelection();
                base.ExecutionStop();
            }
            catch (Exception ex)
            {
                base.FinishedProcessing();
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                base.FinishedProcessing();
                ((frmMainMenu)this.ParentForm).ExecuteTime.Caption = base.ExecuteTime;
            }
        }
Ejemplo n.º 2
0
        private void GetBindingMachine(string mcNo)
        {
            Machine mc = null;

            try
            {
                using (MachineBLL mcBll = new MachineBLL())
                {
                    mc = mcBll.GetMachine(mcNo);
                }

                if (mc != null)
                {
                    this.txtMC_NO.Text             = mc.MC_NO;
                    this.txtMACHINE_NAME.Text      = mc.MACHINE_NAME;
                    this.lueMACHINE_TYPE.EditValue = mc.MACHINE_TYPE;
                    this.txtMACHINE_SIZE.Text      = mc.MACHINE_SIZE;
                    this.txtREMARK.Text            = mc.REMARK;
                    this.icbREC_STAT.EditValue     = mc.REC_STAT;
                }
                else
                {
                    this.ClearDataOnScreen();
                    XtraMessageBox.Show(this, "No Data found.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit([Bind("MachineCode,MachineName,MachineProdType,MachineSize,MachineRemark,CompanyCode,Id,Is_Active,Created_Date,Created_By,Updated_Date,Updated_By")] M_Machine m_Machine)
        {
            if (ModelState.IsValid)
            {
                m_Machine.Updated_By = await base.CurrentUserId();

                ResultObject resultObj;

                try
                {
                    using (var mcBll = new MachineBLL())
                    {
                        resultObj = await mcBll.UpdateMachine(m_Machine);

                        _cache.Remove("CACHE_MASTER_MACHINE");
                    }

                    return(Json(new { success = true, data = (M_Machine)resultObj.ObjectValue, message = "Machine Update." }));
                }
                catch (Exception ex)
                {
                    return(Json(new { success = false, data = m_Machine, message = ex.Message }));
                }
            }

            var err = ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage).ToList();

            return(Json(new { success = false, errors = err, data = m_Machine, message = "Update Failed" }));
        }
Ejemplo n.º 4
0
        public void GetMachineList()
        {
            List <Machine> lstMc = null;

            try
            {
                base.BeginProcessing("Begin Load data...", "Please Waiting for Loading Data");

                using (MachineBLL mcBll = new MachineBLL())
                {
                    lstMc = mcBll.GetMachineList(string.Empty);
                }

                this.grdMachine.DataSource = lstMc;

                if (!string.IsNullOrEmpty(this._MACHINE_TYPE))
                {
                    this.grvMachine.ActiveFilterCriteria = (new OperandProperty("MACHINE_TYPE") == new OperandValue(this._MACHINE_TYPE));
                }
            }
            catch (Exception ex)
            {
                base.FinishedProcessing();
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                base.FinishedProcessing();
            }
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> DeleteConfirmed(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ResultObject resultObj;

            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_MACHINE", out List <M_Machine> c_lstMac))
                {
                    var m_Machine = c_lstMac.Find(m => m.Id == id);

                    if (m_Machine == null)
                    {
                        return(NotFound());
                    }

                    m_Machine.Updated_By = await base.CurrentUserId();

                    using (var mcBll = new MachineBLL())
                    {
                        resultObj = await mcBll.DeleteMachine(m_Machine);

                        _cache.Remove("CACHE_MASTER_MACHINE");
                    }

                    return(Json(new { success = true, data = (M_Machine)resultObj.ObjectValue, message = "Machine Deleted." }));
                }

                using (var mcBll = new MachineBLL())
                {
                    var lstMc = await mcBll.GetMachine(id);

                    var m_Machine = lstMc.First();

                    if (m_Machine == null)
                    {
                        return(NotFound());
                    }

                    m_Machine.Updated_By = await base.CurrentUserId();

                    resultObj = await mcBll.DeleteMachine(m_Machine);

                    _cache.Remove("CACHE_MASTER_MACHINE");
                }

                return(Json(new { success = true, data = (M_Machine)resultObj.ObjectValue, message = "Machine Deleted." }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message }));
            }
        }
Ejemplo n.º 6
0
        static public Object CheckRUsersMachine()
        {
            string result = string.Empty;

            try
            {
                string UserId = DNTRequest.GetString("UserId");
                #region 获取列表
                string where = string.Empty;
                where        = "RecordIsDelete=0 and UserID= " + UserId;
                R_UsersMachineBLL bll        = new R_UsersMachineBLL();
                DataTable         dt         = bll.GetList(where).Tables[0];
                string            MachineIds = string.Empty;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    MachineIds = MachineIds + "," + dt.Rows[i]["MachineID"];
                }
                MachineIds = MachineIds.TrimStart(',').TrimEnd(',');
                MachineBLL MBLL = new MachineBLL();

                string sqlMach = string.Empty;
                sqlMach = "MachineID in (" + MachineIds + ")";
                DataTable dt2 = MBLL.GetList(sqlMach).Tables[0];
                DataTable dt3 = dt2.DefaultView.ToTable(false, new string[] { "MachineID", "SN", "Address", "Platform", "Longitude", "Latitude" });
                for (int j = 0; j < dt3.Rows.Count; j++)
                {
                    if (dt3.Rows[j]["Platform"].ToString() == "1")
                    {
                        dt3.Rows[j]["Platform"] = "平板";
                    }
                    else if (dt3.Rows[j]["Platform"].ToString() == "2")
                    {
                        dt3.Rows[j]["Platform"] = "机器";
                    }
                    else
                    {
                        dt3.Rows[j]["Platform"] = "暂无";
                    }
                }
                //object obj = new
                //{
                //    result = true,
                //    code = "",
                //    msg = "",
                //    data = ((dt2 == null) ? (new DataTable()) : (dt2))
                //};
                result = Newtonsoft.Json.JsonConvert.SerializeObject(dt3);

                #endregion
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "操作异常,请稍候再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            return(result);
        }
Ejemplo n.º 7
0
        private void InitializaLOVData()
        {
            this._emptyImage = base.Language.GetBitmap("EmptyImage");
            try
            {
                using (ProductBLL pdBll = new ProductBLL())
                {
                    List <Unit> lstUnit = pdBll.GetUnitList();
                    if (lstUnit != null)
                    {
                        this.lueUNIT.Properties.DataSource = lstUnit;
                        if (lstUnit.Count > 0)
                        {
                            Unit unitTemp = lstUnit.Find(delegate(Unit _unit)
                            {
                                return(_unit.SEQ_NO == "PCS");
                            });
                            if (unitTemp != null)
                            {
                                this.lueUNIT.EditValue = unitTemp.SEQ_NO;
                            }
                            else
                            {
                                //default
                                this.lueUNIT.EditValue = lstUnit[0].SEQ_NO;
                            }
                        }
                    }
                }
                using (MachineBLL mcBll = new MachineBLL())
                {
                    this.lstMachine = mcBll.GetMachineList(string.Empty);
                }

                using (ProductionTypeBLL pdtBll = new ProductionTypeBLL())
                {
                    this.lstProductionType = pdtBll.GetProductionTypeList();
                }

                using (MaterialTypeBLL mtltypeBll = new MaterialTypeBLL())
                {
                    this.lstMtlType = mtltypeBll.GetMTLTypeList(string.Empty);
                }

                this.grvProduct_rps_lueMACHINE.DataSource         = this.lstMachine;
                this.grvProduct_rps_lueMATERIAL_TYPE.DataSource   = this.lstMtlType;
                this.grvProduct_rps_luePRODUCTION_TYPE.DataSource = this.lstProductionType;
                this.luePRODUCTION_TYPE.Properties.DataSource     = this.lstProductionType;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 8
0
        private void UpdateMachine()
        {
            string result = string.Empty;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                Machine mc = new Machine();

                mc.MC_NO        = this.txtMC_NO.Text;
                mc.MACHINE_NAME = this.txtMACHINE_NAME.Text;
                mc.MACHINE_TYPE = (string)this.lueMACHINE_TYPE.EditValue;
                mc.MACHINE_SIZE = this.txtMACHINE_SIZE.Text;
                mc.REMARK       = this.txtREMARK.Text;
                mc.REC_STAT     = (bool)this.icbREC_STAT.EditValue;


                using (MachineBLL mcBll = new MachineBLL())
                {
                    result = mcBll.UpdateMachine(mc, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    GridView view = (GridView)this.grdMachine.Views[0];
                    view.BeginDataUpdate();

                    view.SetFocusedRowCellValue("MACHINE_NAME", mc.MACHINE_NAME);
                    view.SetFocusedRowCellValue("MACHINE_TYPE", mc.MACHINE_TYPE);
                    view.SetFocusedRowCellValue("MACHINE_SIZE", mc.MACHINE_SIZE);
                    view.SetFocusedRowCellValue("REMARK", mc.REMARK);
                    view.SetFocusedRowCellValue("REC_STAT", mc.REC_STAT);

                    view.EndDataUpdate();

                    NotifierResult.Show("Update Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.Cursor    = Cursors.Default;
                this.FormState = eFormState.ReadOnly;
            }
        }
Ejemplo n.º 9
0
 public async Task <IActionResult> GetMachineByProdType(int?id)
 {
     try
     {
         using (var mcBll = new MachineBLL())
         {
             return(Json(new { data = await mcBll.GetMachineByProdType(id) }));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(new { success = false, message = ex.Message }));
     }
 }
Ejemplo n.º 10
0
        public void DeleteUser(HttpContext context)
        {
            string result = string.Empty;

            try
            {
                var usersIds = DNTRequest.GetString("UsersID");
                if (string.IsNullOrEmpty(usersIds))
                {
                    result = DNTRequest.GetResultJson(false, "请先选择一条数据", null);
                    return;
                }
                else
                {
                    MachineBLL opMachineBLL = new MachineBLL();
                    Machine    modelMachine = new Machine();
                    modelMachine = opMachineBLL.GetModelByUserId(Convert.ToInt32(usersIds));
                    if (modelMachine != null)
                    {
                        result = DNTRequest.GetResultJson(false, "用户已绑定设备,不允许删除", null);
                    }
                    else
                    {
                        UsersBLL bll = new UsersBLL();
                        bool     res = bll.Delete(Convert.ToInt32(usersIds));
                        if (res)
                        {
                            result = DNTRequest.GetResultJson(true, "删除用户成功", null);

                            #region 通知风控系统

                            #endregion
                        }
                        else
                        {
                            result = DNTRequest.GetResultJson(false, "删除用户失败,请稍后再试", null);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result = DNTRequest.GetResultJson(false, "删除用户异常,请稍后再试", null);
                ExceptionLogBLL.WriteExceptionLogToDB(ex.ToString());
            }
            context.Response.Write(result);
        }
 private void InitializaLOVData()
 {
     try
     {
         using (MachineBLL mcBll = new MachineBLL())
         {
             List <Machine> lstMachine = mcBll.GetMachineList(string.Empty);
             lstMachine.Insert(0, new Machine {
                 MC_NO = string.Empty, MACHINE_NAME = "(All)"
             });
             this.lueMC_NO.Properties.DataSource = lstMachine;
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
     }
 }
Ejemplo n.º 12
0
    public bool CheckExistMachine(string mcNo)
    {
        bool result = false;

        try
        {
            using (MachineBLL mcBll = new MachineBLL())
            {
                result = mcBll.Horizontal_CheckExistMachine(mcNo);
            }
        }
        catch (Exception ex)
        {
            result = false;
        }

        return(result);
    }
Ejemplo n.º 13
0
        // GET: Master/Machine/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            ViewBag.CompCode = await base.CurrentUserComp();

            try
            {
                if (_cache.TryGetValue("CACHE_MASTER_MACHINE", out List <M_Machine> c_lstMac))
                {
                    var m_Machine = c_lstMac.Find(m => m.Id == id);

                    if (m_Machine == null)
                    {
                        return(NotFound());
                    }

                    return(PartialView(m_Machine));
                }

                using (var mcBll = new MachineBLL())
                {
                    var lstMc = await mcBll.GetMachine(id);

                    var m_Machine = lstMc.First();

                    if (m_Machine == null)
                    {
                        return(NotFound());
                    }

                    return(PartialView(m_Machine));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }
        }
Ejemplo n.º 14
0
        private void PrintMachine(List <Machine> lstMachine)
        {
            string userid = string.Empty;

            try
            {
                base.BeginProcessing("Begin Load Report...", "Please Waiting for Loading Report");
                //UiUtility.BeginProcessing("Loading Report", this);
                userid = ((frmMainMenu)this.ParentForm).UserID;
                DataSet ds;

                using (MachineBLL mcBll = new MachineBLL())
                {
                    ds = mcBll.PrintMachineReport(lstMachine);
                }

                ReportViewer viewer = new ReportViewer();
                viewer.AutoCloseAfterPrint = true;

                RPT_MACHINE rpt = new RPT_MACHINE();

                rpt.DataSource = ds;
                rpt.Parameters["paramUserPrint"].Value = ((frmMainMenu)this.ParentForm).UserID;
                rpt.CreateDocument();
                viewer.SetReport(rpt);
                base.FinishedProcessing();
                viewer.ShowDialog();
            }
            catch (Exception ex)
            {
                base.FinishedProcessing();

                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                base.FinishedProcessing();
            }
        }
Ejemplo n.º 15
0
        public void GetMachineListSearchValue(string search)
        {
            List <Machine> lstMc = null;

            try
            {
                using (MachineBLL mcBll = new MachineBLL())
                {
                    lstMc = mcBll.GetMachineList(search);
                }

                this.grdMachine.DataSource = lstMc;

                if (!string.IsNullOrEmpty(this._MACHINE_TYPE))
                {
                    this.grvMachine.ActiveFilterCriteria = (new OperandProperty("MACHINE_TYPE") == new OperandValue(this._MACHINE_TYPE));
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 16
0
        public async Task <IActionResult> GetMachine()
        {
            try
            {
                //var iResult = await base.GetCurUserIdAsync();

                if (_cache.TryGetValue("CACHE_MASTER_MACHINE", out List <M_Machine> c_lstMac))
                {
                    return(Json(new { data = c_lstMac }));
                }

                MemoryCacheEntryOptions options = new MemoryCacheEntryOptions
                {
                    AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300),
                    SlidingExpiration = TimeSpan.FromSeconds(60),
                    Priority          = CacheItemPriority.NeverRemove
                };

                using (var mcBll = new MachineBLL())
                {
                    var lstMac = await mcBll.GetMachine(null);

                    _cache.Set("CACHE_MASTER_MACHINE", lstMac, options);

                    return(Json(new { data = lstMac }));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(new { success = false, message = ex.Message }));
            }

            //using (var mcBll = new MachineBLL())
            //{
            //    return Json(new { data = await mcBll.GetMachine(null) });
            //}
        }
Ejemplo n.º 17
0
        private void InitializaLOVData()
        {
            try
            {
                using (ProductionTypeBLL pdtBll = new ProductionTypeBLL())
                {
                    List <ProductionType> lstProdType = pdtBll.GetProductionTypeList();
                    lstProdType.Insert(0, new ProductionType {
                        SEQ_NO = string.Empty, NAME = "(All)"
                    });
                    this.luePRODUCTION_TYPE.Properties.DataSource = lstProdType;
                }

                using (MachineBLL mcBll = new MachineBLL())
                {
                    List <Machine> lstMachine = mcBll.GetMachineList(string.Empty);
                    lstMachine.Insert(0, new Machine {
                        MC_NO = string.Empty, MACHINE_NAME = "(All)"
                    });
                    this.lueMC_NO.Properties.DataSource = lstMachine;
                }

                using (PartyBLL partyBll = new PartyBLL())
                {
                    List <Party> lstParty = partyBll.LovPratyList("C", string.Empty);
                    lstParty.Insert(0, new Party {
                        PARTY_ID = string.Empty, PARTY_NAME = "(All)"
                    });
                    this.lueCUSTOMER.Properties.DataSource = lstParty;
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 更新设备信息
        /// </summary>
        static void UpdateMachineSettings()
        {
            try
            {
                string description = string.Empty;
                string ip          = string.Empty;
                string mac         = string.Empty;
                try
                {
                    ip  = HttpContext.Current.Request.UserHostAddress;//IpHelper.GetClientIP2();
                    mac = IpHelper.GetClientMacAddress();
                    if (mac == "00-00-00-00-00-00")
                    {
                        mac = IpHelper.GetLocalMacAddress();
                    }
                }
                catch { }

                int currentUserId = MerchantFrontCookieBLL.GetMerchantFrontUserId();

                MachineBLL opMachineBLL = new MachineBLL();
                Machine    modelMachine = new Machine();
                if (currentUserId != 0)
                {
                    modelMachine = opMachineBLL.GetModelByUserId(currentUserId);
                }

                int machineId = 0;
                if (modelMachine != null)
                {
                    machineId = modelMachine.MachineID;
                }

                #region 设置位置信息
                string longitude    = string.Empty;
                string latitude     = string.Empty;
                string locationData = string.Empty;

                #region 获取当前位置信息
                string jsonText = MachineLocationLogBLL.GetLocationInfo();
                if (!string.IsNullOrEmpty(jsonText))
                {
                    JObject o = JObject.Parse(jsonText);
                    longitude = o["content"]["point"]["x"].ToString();
                    latitude  = o["content"]["point"]["y"].ToString();
                }
                #endregion

                #region 逆地理位置解析
                string locationAddress = string.Empty;
                string locationXml     = string.Empty;
                if (!string.IsNullOrEmpty(longitude) && !string.IsNullOrEmpty(latitude))
                {
                    locationData = MachineLocationLogBLL.GetAddressByLocation(longitude, latitude, "xml", 0);
                    if (!string.IsNullOrEmpty(locationData))
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(locationData);
                        //locationXml = doc.DocumentElement.InnerXml;
                        //settings.OmitXmlDeclaration = true;//这一句表示忽略xml声明
                        XmlNodeList locationNodeList = doc.SelectNodes("GeocoderSearchResponse/result");
                        if (locationNodeList != null)
                        {
                            foreach (XmlNode locationNode in locationNodeList)
                            {
                                XmlNode formatted_address = locationNode.SelectSingleNode("formatted_address");
                                if (formatted_address != null)
                                {
                                    locationAddress += formatted_address.InnerText;
                                }
                                XmlNode sematic_description = locationNode.SelectSingleNode("sematic_description");
                                if (sematic_description != null)
                                {
                                    locationAddress += sematic_description.InnerText;
                                }
                            }
                        }
                    }
                }
                #endregion

                #region 更新设备信息
                opMachineBLL = new MachineBLL();
                modelMachine = new Machine();
                modelMachine = opMachineBLL.GetModel(machineId);
                if (modelMachine != null)
                {
                    modelMachine.MAC             = mac;
                    modelMachine.Longitude       = longitude;
                    modelMachine.Latitude        = latitude;
                    modelMachine.LocationAddress = locationAddress;
                    opMachineBLL.Update(modelMachine);
                }
                #endregion

                #region 记录位置信息日志
                if (!string.IsNullOrEmpty(locationData))
                {
                    string xmlheader = "<xml version=\"1.0\" encoding=\"utf-8\">";
                    locationXml = locationData.Replace("?", "");
                    locationXml = locationXml.Replace(xmlheader, string.Empty);
                }

                MachineLocationLogBLL opMachineLocationLogBLL = new MachineLocationLogBLL();
                MachineLocationLog    modelMachineLocationLog = new MachineLocationLog();
                modelMachineLocationLog.UserId          = currentUserId;
                modelMachineLocationLog.MachineId       = machineId;
                modelMachineLocationLog.IP              = ip;
                modelMachineLocationLog.MAC             = mac;
                modelMachineLocationLog.Longitude       = longitude;
                modelMachineLocationLog.Latitude        = latitude;
                modelMachineLocationLog.LocationAddress = locationAddress;
                modelMachineLocationLog.LocationData    = locationXml;
                modelMachineLocationLog.CreateDate      = DateTime.Now;
                modelMachineLocationLog.IsDeleted       = 0;
                modelMachineLocationLog.Remark          = description;
                int res = opMachineLocationLogBLL.Add(modelMachineLocationLog);

                #endregion

                #endregion
            }
            catch (Exception ex)
            {
                ExceptionLogBLL.WriteExceptionLogToDB("心跳检查异常," + ex.ToString());
            }
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                UsersBLL   oUsersBLL   = new UsersBLL();
                MachineBLL oMachineBLL = new MachineBLL();
                userId = MerchantFrontCookieBLL.GetMerchantFrontUserId();
                if (userId > 0)
                {
                    Machine oMachine = new Machine();
                    oMachine = oMachineBLL.GetModelByUserId(userId);
                    if (oMachine != null)
                    {
                        MachineID = oMachine.MachineID;
                    }
                }
                TransNo               = BWJSCommonHelper.SafeString(Request["transNo"], "");
                TransNo               = string.IsNullOrEmpty(TransNo) ? "" : TransNo.Trim();
                CaseCode              = BWJSCommonHelper.SafeString(Request["CaseCode"], "");
                CaseCode              = string.IsNullOrEmpty(CaseCode) ? "" : CaseCode.Trim();
                protectitemid         = BWJSCommonHelper.SafeString(Request["protectitemid"], "");
                protectitemid         = string.IsNullOrEmpty(protectitemid) ? "" : protectitemid.Trim();
                priceArgsId           = BWJSCommonHelper.SafeString(Request["priceArgsId"], "");
                priceArgsId           = string.IsNullOrEmpty(priceArgsId) ? "" : priceArgsId.Trim();
                price                 = BWJSCommonHelper.SafeString(Request["price"], "");
                price                 = string.IsNullOrEmpty(price) ? "" : price.Trim();
                SinglePrice           = BWJSCommonHelper.SafeString(Request["SinglePrice"], "");
                SinglePrice           = string.IsNullOrEmpty(SinglePrice) ? "" : SinglePrice.Trim();
                buyCount              = BWJSCommonHelper.SafeString(Request["buyCount"], "");
                buyCount              = string.IsNullOrEmpty(buyCount) ? "" : buyCount.Trim();
                healthId              = BWJSCommonHelper.SafeString(Request["healthId"], "");
                healthId              = string.IsNullOrEmpty(healthId) ? "" : healthId.Trim();
                productId             = DNTRequest.GetInt("productId", 0);
                insurantDateLimitVal  = BWJSCommonHelper.SafeString(Request["hdinsurantDateLimitVal"], "");  //承保值
                insurantDateLimitUnit = BWJSCommonHelper.SafeString(Request["hdinsurantDateLimitUnit"], ""); //承保单位
                CardTypeBLL oCardTypeBLL = new CardTypeBLL();
                oCardTypeList = oCardTypeBLL.GetCardTypeList(CaseCode);
                RelationBLL oRelationBLL = new RelationBLL();
                listRelationViewMode = oRelationBLL.GetRelationViewModelList(CaseCode);
                switch (CaseCode)
                {
                case "0000052178002133":
                    isShowProvince = true;
                    isoneSelf      = true;//被保人必须是投保人本人
                    break;

                case "0001075211202628":
                    isShowcaichansuozaidi    = true;
                    isShowrelatedPersonHouse = true;
                    isoneSelf = true;
                    break;

                case "0000076164701939":
                    isluyouxianCXMDD       = true;
                    oTravelDestinationList = oTravelDestinationBLL.GetTravelDestinationList(CaseCode);
                    ProductDestinationReq oProductDestinationReqModel = new ProductDestinationReq();
                    oProductDestinationReqModel.caseCode = CaseCode;
                    oProductDestinationReqModel.transNo  = TransNo;
                    ProductCXDestinationResp oProductCXDestinationResp = oBaoxianDataBLL.ProductDestinations(oProductDestinationReqModel);
                    CXMDDStr = GetCXMDDStr(oProductCXDestinationResp);
                    //     isShowrelatedPersonHouse = true;
                    break;

                case "0000052067400588":
                    isShowcaichansuozaidi = true;
                    isoneSelf             = true;
                    break;

                case "0001077178502139":
                    typeMen = true;
                    break;

                case "0001077178602140":
                    typeWomen = true;
                    break;

                case "0001076209802609":    //一起慧99-百万医疗保险 无门诊计划
                    isHaveJob = true;
                    break;

                case "0001076211102627":    //一起慧99-百万医疗保险 有门诊计划
                    isHaveJob = true;
                    break;

                case "0001075190802342":    //少儿住院宝
                    isOnlyOthers    = true;
                    StartDateParame = 3;    // 这个产品要求(起保日期只能为投保日起第三天)
                    break;
                }
                List <Products> oProductsList = bll.ProductsByCaseCode(CaseCode);
                if (oProductsList != null)
                {
                    ProModel = oProductsList.FirstOrDefault();
                }
            }
        }
Ejemplo n.º 20
0
        private void InsertMachine()
        {
            string result = string.Empty;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                Machine mc = new Machine();

                mc.MC_NO        = this.txtMC_NO.Text;
                mc.MACHINE_NAME = this.txtMACHINE_NAME.Text;
                mc.MACHINE_TYPE = (string)this.lueMACHINE_TYPE.EditValue;
                mc.MACHINE_SIZE = this.txtMACHINE_SIZE.Text;
                mc.REMARK       = this.txtREMARK.Text;
                mc.REC_STAT     = (bool)this.icbREC_STAT.EditValue;


                using (MachineBLL mcBll = new MachineBLL())
                {
                    result = mcBll.InsertMachine(mc, ((frmMainMenu)this.ParentForm).UserID);
                }

                if (result.Equals("OK"))
                {
                    NotifierResult.Show("Insert Complete", "Result", 50, 1000, 50, NotifyType.Safe);
                }
                else
                {
                    NotifierResult.Show(result, "Error", 100, 1000, 0, NotifyType.Warning);
                }
            }
            catch (Exception ex)
            {
                this.Cursor = Cursors.Default;
                NotifierResult.Show(ex.Message, "Error", 100, 1000, 0, NotifyType.Warning);
            }
            finally
            {
                this.Cursor    = Cursors.Default;
                this.FormState = eFormState.ReadOnly;

                this.lueMACHINE_TYPE.EditValue = null;
                this.GetMachineList(string.Empty);

                if (result.Equals("OK"))
                {
                    GridView viewList = (GridView)this.grdMachine.Views[0];
                    viewList.ClearSorting();
                    int position = UiUtility.GetRowHandleByColumnValue(viewList, "MC_NO", this.txtMC_NO.Text);
                    if (position != 0)
                    {
                        if (position != GridControl.InvalidRowHandle)
                        {
                            this.dntMachine.Position = position;
                        }
                    }
                    else
                    {
                        viewList.FocusedRowHandle = 0;
                    }
                }
            }
        }