public CustomerBll GetCustomerIDFromname(string Name)
        {
            CustomerBll dc = new CustomerBll();

            SqlConnection conn = new SqlConnection(myconstring);

            DataTable dt = new DataTable();

            try
            {
                string sql = "Select id from customer where name = '" + Name + "'";

                SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

                conn.Open();


                adapter.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    dc.id = int.Parse(dt.Rows[0]["id"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
            }

            return(dc);
        }
        public bool Delete(CustomerBll c)
        {
            bool          isSuccess = false;
            SqlConnection con       = new SqlConnection(myconstring);

            try
            {
                string     query = "Delete From customer where id = @id";
                SqlCommand cmd   = new SqlCommand(query, con);

                cmd.Parameters.AddWithValue("@id", c.id);
                con.Open();
                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                con.Close();
            }

            return(isSuccess);
        }
示例#3
0
        private void txtCustomer_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (KeyPressHelper.IsEnter(e))
            {
                var customerName = ((AdvancedTextbox)sender).Text;

                ICustomerBll bll            = new CustomerBll(_log);
                var          listOfCustomer = bll.GetByName(customerName);

                if (listOfCustomer.Count == 0)
                {
                    MsgHelper.MsgWarning("Data customer tidak ditemukan");
                    txtCustomer.Focus();
                    txtCustomer.SelectAll();
                }
                else if (listOfCustomer.Count == 1)
                {
                    _customer        = listOfCustomer[0];
                    txtCustomer.Text = _customer.nama_customer;
                    KeyPressHelper.NextFocus();
                }
                else // data lebih dari satu
                {
                    var frmLookup = new FrmLookupReferensi("Data Customer", listOfCustomer);
                    frmLookup.Listener = this;
                    frmLookup.ShowDialog();
                }
            }
        }
示例#4
0
        // GET api/customerapi/5
        public CCustomer Get(int id)
        {
            var user = (CSign)HttpContext.Current.Session[ConfigurationManager.AppSettings["AuthSaveKey"]];

            if (user == null)
            {
                throw new HttpResponseException(new SiginFailureMessage());
            }
            using (var dal = DalBuilder.CreateDal(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, 0))
            {
                CCustomer customer;
                try
                {
                    dal.Open();
                    customer = CustomerBll.Get(dal, id);
                    dal.Close();
                }
                catch (Exception ex)
                {
                    LogBll.Write(dal, new CLog
                    {
                        LogUser    = string.Format("{0}-{1}", user.UserCode, user.UserName),
                        LogContent = string.Format("{0}#{1}", "Customer.Get", ex.Message),
                        LogType    = LogType.系统异常
                    });
                    throw new HttpResponseException(new SystemExceptionMessage());
                }

                if (customer == null)
                {
                    throw new HttpResponseException(new DataNotFoundMessage());
                }
                return(customer);
            }
        }
示例#5
0
        private void print()
        {
            StringBuilder  strb           = new StringBuilder();
            WarehousingBll warehousingBll = new WarehousingBll();
            DataSet        ds             = warehousingBll.customerRs(customerId);
            CustomerBll    customerBll    = new CustomerBll();

            Customer cus = customerBll.getCustomer(customerId);

            customer = cus.CustomerName;
            kinds    = repBll.getMonkinds(customerId, 1);
            counts   = repBll.getTotalMon(customerId, 1);
            strb.Append("<tbody>");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                strb.Append("<tr><td>" + (i + 1) + "</td>");
                strb.Append("<td>" + ds.Tables[0].Rows[i]["ISBN"].ToString() + "</td>");
                strb.Append("<td>" + ds.Tables[0].Rows[i]["bookNum"].ToString() + "</td>");
                strb.Append("<td><nobr>" + ds.Tables[0].Rows[i]["bookName"].ToString() + "</nobr></td>");
                strb.Append("<td>" + ds.Tables[0].Rows[i]["count"].ToString() + "</td>");
                strb.Append("<td>" + ds.Tables[0].Rows[i]["customerName"].ToString() + "</td>");
                strb.Append("<td>" + ds.Tables[0].Rows[i]["regionName"].ToString() + "</td>");
                strb.Append("<td><nobr>" + ds.Tables[0].Rows[i]["dateTime"].ToString() + "</nobr></td></tr>");
            }
            strb.Append("</tbody>");
            Response.Write(strb.ToString() + ":|" + kinds + ":|" + counts + ":|" + customer);
            Response.End();
        }
示例#6
0
        public JsonResult InitSingle()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            var   tempAuth           = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId);
            if (tempAuth.ErrorType != 1)
            {
                return(Json(tempAuth));
            }
            #endregion

            #region InitSingle
            Guid ID = RequestParameters.PGuid("ID");
            if (ID != Guid.Empty)
            {
                var usersBll      = new CustomerBll();
                var item          = usersBll.GetVObjectById(ID);
                var szDetailModel = new ResultDetail();
                szDetailModel.Entity    = item;
                szDetailModel.ErrorType = 1;
                return(Json(szDetailModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            #endregion
        }
        private void LoadCustomer(string name)
        {
            ICustomerBll bll = new CustomerBll(_log);

            _listOfCustomer = bll.GetByName(name);

            FillDataHelper.FillCustomer(chkListBox, _listOfCustomer);
        }
示例#8
0
 public RentBll(OfferBll offerBll, string customerEmail, bool insuranceCase)
 {
     Customer       = new CustomerBll();
     OfferBll       = offerBll;
     StartDate      = DateTime.Now.Subtract(new TimeSpan(3, 0, 0, 0));
     Customer.Email = customerEmail;
     InsuranceCase  = insuranceCase;
 }
        private void LoadCustomer()
        {
            ICustomerBll bll = new CustomerBll(_log);

            _listOfCustomer = bll.GetAll();

            FillDataHelper.FillCustomer(chkListBox, _listOfCustomer);
        }
示例#10
0
        public ActionResult CreateRent(int offerIndex)
        {
            RentView rentView = new RentView {
                OfferId = offerIndex
            };
            CustomerBll customerBll = new CustomerBll();

            return(View(rentView));
        }
示例#11
0
        // POST api/customerapi
        public CCustomer Post(CCustomer value)
        {
            var user = (CSign)HttpContext.Current.Session[ConfigurationManager.AppSettings["AuthSaveKey"]];

            if (user == null)
            {
                throw new HttpResponseException(new SiginFailureMessage());
            }
            using (
                var dal =
                    DalBuilder.CreateDal(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, 0)
                )
            {
                bool ok;
                try
                {
                    dal.Open();
                    ok = CustomerBll.Create(dal, value, string.Format("{0}-{1}", user.UserCode, user.UserName));
                }
                catch (Exception ex)
                {
                    if (ex.Message.StartsWith("违反了 UNIQUE KEY 约束"))
                    {
                        throw new HttpResponseException(new PrimaryRepeatedMessge());
                    }
                    LogBll.Write(dal, new CLog
                    {
                        LogUser    = string.Format("{0}-{1}", user.UserCode, user.UserName),
                        LogContent = string.Format("{0}#{1}", "Customer.Post", ex.Message),
                        LogType    = LogType.系统异常
                    });
                    throw new HttpResponseException(new SystemExceptionMessage());
                }
                if (!ok)
                {
                    LogBll.Write(dal, new CLog
                    {
                        LogContent = string.Format("新建客户{0}-{1}", value.CustomerCode, value.CustomerName),
                        LogType    = LogType.操作失败,
                        LogUser    = string.Format("{0}-{1}", user.UserCode, user.UserName)
                    });
                    throw new HttpResponseException(new DealFailureMessage());
                }
                LogBll.Write(dal, new CLog
                {
                    LogContent = string.Format("新建客户{0}-{1}", value.CustomerCode, value.CustomerName),
                    LogType    = LogType.操作成功,
                    LogUser    = string.Format("{0}-{1}", user.UserCode, user.UserName)
                });
                dal.Close();
                return(value);
            }
        }
示例#12
0
        public JsonResult ListPhyDel()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.PhyDelete;
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            var customerId = RequestParameters.PGuid("ids");
            if (customerId == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            var bedId = RequestParameters.PGuid("bedIds");
            //if (bedId == Guid.Empty)
            //{
            //    var sRetrunModel = new ResultMessage();
            //    sRetrunModel.ErrorType = 0;
            //    sRetrunModel.MessageContent = "参数错误.";
            //    return Json(sRetrunModel);
            //}
            var  welfareCentreId = Utits.WelfareCentreID;
            var  cBll            = new CustomerBll();
            bool isFlag          = cBll.PhysicalDelete(customerId, bedId, welfareCentreId);
            if (isFlag)
            {
                ParamState = "4";
                ParamID    = customerId.ToString();
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
示例#13
0
        public void AddNewCustomer(CustomerBll customerBll)
        {
            Customer customer = new Customer
            {
                Id        = customerBll.Id,
                FirstName = customerBll.FirstName,
                Surname   = customerBll.Surname,
                Email     = customerBll.Email
            };

            if (_dataSource.IsCustomerExist(customer) != 1)
            {
                _dataSource.AddNewCustomer(customer);
            }
        }
        public bool update(CustomerBll c)
        {
            bool          isSuccess = false;
            SqlConnection con       = new SqlConnection(myconstring);

            try
            {
                String     sql = "Update customer set type = @type,name = @name,email=@email,contact=@contact,address=@address,added_date=@added_date,added_by=@added_by where id=@id";
                SqlCommand cmd = new SqlCommand(sql, con);


                cmd.Parameters.AddWithValue("@type", c.Type);
                cmd.Parameters.AddWithValue("@name", c.name);
                cmd.Parameters.AddWithValue("@email", c.Email);
                cmd.Parameters.AddWithValue("@contact", c.Contact);
                cmd.Parameters.AddWithValue("@address", c.Address);
                cmd.Parameters.AddWithValue("@added_date", c.added_date);
                cmd.Parameters.AddWithValue("@added_by", c.added_by);
                cmd.Parameters.AddWithValue("@id", c.id);



                con.Open();

                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }

                else
                {
                    isSuccess = false;
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            finally
            {
                con.Close();
            }

            return(isSuccess);
        }
示例#15
0
        public ActionResult CreateRent(RentView rentView)
        {
            CustomerBll customerBll = new CustomerBll
            {
                FirstName = rentView.Customer.FirstName,
                Surname   = rentView.Customer.Surname,
                Email     = rentView.Customer.Email
            };
            RentBll rentBll = new RentBll(_sharingService.GetOfferById(rentView.OfferId), rentView.Customer.Email, rentView.InsuranceCase)
            {
                Customer = customerBll
            };

            _sharingService.CreateRent(rentBll);
            return(Redirect("/Home/Index"));
        }
示例#16
0
        private void ShowEntryCustomer()
        {
            var isGrant = RolePrivilegeHelper.IsHaveHakAkses("mnuCustomer", _pengguna);

            if (!isGrant)
            {
                MsgHelper.MsgWarning("Maaf Anda tidak mempunyai otoritas untuk mengakses menu ini");
                return;
            }

            ICustomerBll customerBll      = new CustomerBll(_log);
            var          frmEntryCustomer = new FrmEntryCustomer("Tambah Data Customer", customerBll);

            frmEntryCustomer.Listener = this;
            frmEntryCustomer.ShowDialog();
        }
示例#17
0
        public string GetCustomerName()
        {
            var buf  = new StringBuilder();
            var cBll = new CustomerBll();
            var list = cBll.SearchListByValid(Utits.WelfareCentreID);

            buf.AppendFormat("<option value=\"{0}\">{1}</option>", "请选择", "==请选择==");
            if (list != null)
            {
                foreach (var item in list)
                {
                    buf.AppendFormat("<option value=\"{0}\">{1}</option>", item.ID, item.CustomerName);
                }
            }
            return(buf.ToString());
        }
示例#18
0
        // GET api/uniquecheckapi/5
        public CCheckResultModel Get(string dataSource, string value)
        {
            var user = (CSign)HttpContext.Current.Session[ConfigurationManager.AppSettings["AuthSaveKey"]];

            if (user == null)
            {
                throw new HttpResponseException(new SiginFailureMessage());
            }
            using (var dal = DalBuilder.CreateDal(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, 0))
            {
                try
                {
                    CCheckResultModel rst;
                    dal.Open();
                    switch (dataSource)
                    {
                    case "User.UserCode":
                        rst = UserBll.CheckUserCodeUnique(dal, value);
                        break;

                    case "Customer.CustomerCode":
                        rst = CustomerBll.CheckCustomerCodeUnique(dal, value);
                        break;

                    default:
                        throw new Exception("UniqueCheckInputer错误,没有找到指定DataSource");
                    }

                    dal.Close();
                    return(rst);
                }
                catch (Exception ex)
                {
                    LogBll.Write(dal, new CLog
                    {
                        LogUser    = string.Format("{0}-{1}", user.UserCode, user.UserName),
                        LogContent = string.Format("{0}#{1}", "UniqueCheck.Get", ex.Message),
                        LogType    = LogType.系统异常
                    });
                    throw new HttpResponseException(new SystemExceptionMessage());
                }
            }
        }
示例#19
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string keyword = textBox1.Text;

            if (textBox1.Text == "")
            {
                txt_name.Text    = "";
                txt_email.Text   = "";
                txt_contact.Text = "";
                txt_address.Text = "";
            }

            CustomerBll d = dl.searchcustomerDealerorforTransaction(keyword);

            txt_name.Text    = d.name;
            txt_contact.Text = d.Contact;
            txt_email.Text   = d.Email;
            txt_address.Text = d.Address;
        }
示例#20
0
        private void txtCustomer_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (KeyPressHelper.IsEnter(e))
            {
                var customerName = ((AdvancedTextbox)sender).Text;

                if (customerName.Length == 0)
                {
                    ShowMessage("Nama pelanggan tidak boleh kosong", true);
                    return;
                }

                ICustomerBll bll            = new CustomerBll(_log);
                var          listOfCustomer = bll.GetByName(customerName);

                if (listOfCustomer.Count == 0)
                {
                    ShowMessage("Data pelanggan tidak ditemukan", true);

                    txtCustomer.Focus();
                    txtCustomer.SelectAll();
                }
                else if (listOfCustomer.Count == 1)
                {
                    _customer        = listOfCustomer[0];
                    txtCustomer.Text = _customer.nama_customer;

                    ShowMessage("");
                    lblStatusBar.Text = lblStatusBar.Text.Replace("Cari Pelanggan", "Reset Pelanggan");

                    KeyPressHelper.NextFocus();
                }
                else // data lebih dari satu
                {
                    var frmLookup = new FrmLookupReferensi("Data Pelanggan", listOfCustomer);
                    frmLookup.Listener = this;
                    frmLookup.ShowDialog();
                }
            }
        }
        public CustomerBll searchcustomerDealerorforTransaction(string keyword)
        {
            CustomerBll dc = new CustomerBll();

            SqlConnection conn = new SqlConnection(myconstring);



            DataTable dt = new DataTable();

            try{
                string sql = "Select name,email,contact,address from customer where id like '%" + keyword + "%' or name Like '%" + keyword + "%' ";

                SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);

                conn.Open();

                adapter.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    dc.name    = dt.Rows[0]["name"].ToString();
                    dc.Email   = dt.Rows[0]["email"].ToString();
                    dc.Contact = dt.Rows[0]["contact"].ToString();
                    dc.Address = dt.Rows[0]["address"].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }

            return(dc);
        }
示例#22
0
        public string setCareContent(string bizContent, long timeStamp, string signature)
        {
            MessageLog.WriteLog(new LogParameterModel
            {
                ClassName        = this.GetType().ToString(),
                MethodName       = "setCareContent",
                MethodParameters = $"bizContent:{bizContent},timeStamp:{timeStamp},signature:{signature}",
                LogLevel         = ELogLevel.Info,
                Message          = "接收参数",
                PathPrefix       = "/log/ws",
                LogExt           = "txt"
            });
            var result    = new ResultModel();
            var paramItem = CommonLib.JsonHelper.Deserialize <SetNursingDto>(bizContent);

            if (paramItem == null)
            {
                result.resultCode    = 0;
                result.resultMessage = "操作失败:bizContent不合法.";
                return(result.ToJSON());
            }

            var HgID         = paramItem.userId;
            var customerBll  = new CustomerBll();
            var itemCustomer = customerBll.GetVijObjectById(paramItem.welfareCentreId, paramItem.bedNumber);

            if (itemCustomer == null)
            {
                result.resultCode    = 0;
                result.resultMessage = "未获得信息.";
                return(result.ToJSON());
            }
            var          arrayNursingIds = paramItem.nursingIds.Split(',');
            var          list            = new List <tbNursingPer>();
            tbNursingPer item;
            var          nowTime          = DateTime.Now;
            Guid         NursingMessageID = Guid.NewGuid();

            foreach (var nursingId in arrayNursingIds)
            {
                if (!RegexValidate.IsInt(nursingId))
                {
                    continue;
                }
                item                  = new tbNursingPer();
                item.ID               = Guid.NewGuid();
                item.CustomerID       = itemCustomer.ID;
                item.NursingRankTopID = Convert.ToInt32(nursingId);
                item.NursingRankID    = Convert.ToInt32(nursingId);
                item.HgID             = HgID;
                item.OperatorUserID   = HgID;
                item.NursingMessageID = NursingMessageID;
                item.NursingTime      = nowTime;
                item.OperateDate      = nowTime;
                item.CreateDate       = nowTime;
                item.IsValid          = 1;
                item.Remark           = "cr";
                item.WelfareCentreID  = paramItem.welfareCentreId;
                list.Add(item);
            }

            var             listExt = new List <tbNursingPerExt>();
            tbNursingPerExt itemExt;
            var             listNursingExt = JsonHelper.DeserializeToIList <nursingExtModel>(paramItem.nursingExt);

            if (listNursingExt != null)
            {
                foreach (var itemInfo in listNursingExt)
                {
                    itemExt                  = new tbNursingPerExt();
                    itemExt.ID               = Guid.NewGuid();
                    itemExt.CustomerID       = itemCustomer.ID;
                    itemExt.NursingRankTopID = itemInfo.nursingId;
                    itemExt.NursingRankID    = itemInfo.nursingId;
                    itemExt.extTitle         = itemInfo.extTitle;
                    itemExt.extContent       = itemInfo.extContent;
                    itemExt.HgID             = HgID;
                    itemExt.OperatorUserID   = HgID;
                    itemExt.NursingTime      = nowTime;
                    itemExt.NursingMessageID = NursingMessageID;
                    itemExt.OperateDate      = nowTime;
                    itemExt.CreateDate       = nowTime;
                    itemExt.IsValid          = 1;
                    itemExt.Remark           = "cr";
                    itemExt.WelfareCentreID  = paramItem.welfareCentreId;
                    listExt.Add(itemExt);
                }
            }
            var cBll   = new NursingPerBll();
            var isFlag = cBll.AddAll(paramItem.welfareCentreId, HgID, itemCustomer.ID, list, listExt);

            if (isFlag)
            {
                result.resultCode    = 1;
                result.resultMessage = "操作成功.";
            }
            else
            {
                result.resultCode    = 0;
                result.resultMessage = "操作失败.";
            }
            return(result.ToJSON());
        }
示例#23
0
        public void DoUploadImg()
        {
            HttpFileCollection fileCollection = System.Web.HttpContext.Current.Request.Files;//文件列表
            var id = RequestParameters.PGuid("txtId2");

            if (fileCollection.Count > 0)
            {
                HttpPostedFile file = fileCollection[0];

                //当前文件后缀名
                string ext = System.IO.Path.GetExtension(file.FileName).ToLower();
                //验证文件类型是否正确
                string[] arrayExtension = { ".gif", ".jpg", ".jpeg", ".png", ".bmp" };
                if (!arrayExtension.Contains(ext))
                {
                    Response.Write("<script>window.parent.ImgUpload_Callback('-3');</script>");
                    return;
                }
                //验证文件的大小
                if (file.ContentLength > 1024 * 1024 * 10)//10M
                {
                    Response.Write("<script>window.parent.ImgUpload_Callback('-4');</script>");
                    return;
                }
                //当前文件上传的目录
                string _fileSavePath = Server.MapPath("/Upload/CustomerHeadImg/");
                //当前待上传的服务端路径
                string _fileName = DateTime.Now.ToString("yyyyMMddhhmmss") + ext;
                //开始上传
                try
                {
                    if (!System.IO.Directory.Exists(_fileSavePath))
                    {
                        System.IO.Directory.CreateDirectory(_fileSavePath);
                    }

                    file.SaveAs(_fileSavePath + _fileName);
                    var cBll    = new CustomerBll();
                    var cusItem = cBll.GetObjectById(id);
                    if (cusItem != null)
                    {
                        Guid customerid      = cusItem.ID;
                        Guid welfareCentreId = cusItem.WelfareCentreID ?? Utits.WelfareCentreID;
                        var  isFlag          = cBll.UpdateCustomerHeadImg(customerid, welfareCentreId, _fileName);
                        if (isFlag == true)
                        {
                            Response.Write("<script>window.parent.ImgUpload_Callback('1|" + _fileName + "');</script>");
                        }
                        else
                        {
                            Response.Write("<script>window.parent.ImgUpload_Callback('-1');</script>");
                        }
                    }
                }
                catch
                {
                    //上传失败
                    Response.Write("<script>window.parent.ImgUpload_Callback('-1');</script>");
                    return;
                }
                //这里window.parent.PictureUpload_Callback()是我在前端页面中写好的javascript function,此方法主要用于输出异常和上传成功后的图片地址
                //如果成功返回的数据是需要返回两个字符串,我在这里使用了|分隔  例: 成功信息|/Test/hello.jpg
                Response.Write("<script>window.parent.ImgUpload_Callback('1|" + _fileName + "');</script>");
            }
            else
            {
                //上传失败
                Response.Write("<script>window.parent.ImgUpload_Callback('-1');</script>");
            }
        }
示例#24
0
        public JsonResult SearchList()
        {
            #region 权限控制
            int[] iRangePage         = { ListPageNodeId };
            int   iCurrentPageNodeId = RequestParameters.Pint("NodeId");
            var   tempAuth           = Utits.IsNodePageAuth(iRangePage, iCurrentPageNodeId);
            if (tempAuth.ErrorType != 1)
            {
                return(Json(tempAuth));
            }
            #endregion

            //当前页
            int iCurrentPage = RequestParameters.Pint("currentPage");
            iCurrentPage = iCurrentPage <= 0 ? 1 : iCurrentPage;
            //索引页
            int iPageIndex = iCurrentPage - 1;
            //一页的数量
            int iPageSize = RequestParameters.Pint("pageSize");
            iPageSize = iPageSize <= 0 ? 5 : iPageSize;
            iPageSize = iPageSize > 100 ? 100 : iPageSize;
            //总记录数量
            int iTotalRecord = 0;

            #region 查询条件
            var searchCondition = new ConditionModel();

            var WhereList = new List <WhereCondition>();

            int[] Stage = { (int)ECustomerType.Rzspb, (int)ECustomerType.RuYuan };
            for (int i = 0; i < Stage.Length; i++)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "Stage";
                whereCondition.FieldValue    = Stage[i];
                whereCondition.Relation      = "OR";
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            string CustomerName = RequestParameters.Pstring("CustomerName");
            if (CustomerName.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "CustomerName";
                whereCondition.FieldValue    = CustomerName;
                whereCondition.FieldOperator = EnumOper.Contains;
                WhereList.Add(whereCondition);
            }
            var welfareCentreId = Utits.WelfareCentreID;
            if (welfareCentreId != null)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "WelfareCentreID";
                whereCondition.FieldValue    = welfareCentreId;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            Guid userId = RequestParameters.PGuid("userId");
            if (userId != Guid.Empty)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "OperatorUserID";
                whereCondition.FieldValue    = userId;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            var CustomerGender = RequestParameters.PintNull("CustomerGender");//性别
            if (CustomerGender != null)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "CustomerGender";
                whereCondition.FieldValue    = CustomerGender;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            var CustomerHJDQBySearch = RequestParameters.Pstring("CustomerHJDQBySearch");//
            if (CustomerHJDQBySearch.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "CustomerHJDQ_dic";
                whereCondition.FieldValue    = CustomerHJDQBySearch;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            var AgeBySearch = RequestParameters.Pstring("AgeBySearch");
            if (AgeBySearch.Length > 0)
            {
                var ageList = AgeBySearch.Split('-');
                if (ageList.Count() == 2)
                {
                    if (ageList[0] != null)
                    {
                        var whereCondition = new WhereCondition();
                        whereCondition.FieldName     = "CustomerAge";
                        whereCondition.FieldValue    = ageList[0];
                        whereCondition.FieldOperator = EnumOper.GreaterThanEqual;
                        WhereList.Add(whereCondition);
                    }
                    if (ageList[1] != null)
                    {
                        var whereCondition = new WhereCondition();
                        whereCondition.FieldName     = "CustomerAge";
                        whereCondition.FieldValue    = ageList[1];
                        whereCondition.FieldOperator = EnumOper.LessThanEqual;
                        WhereList.Add(whereCondition);
                    }
                }
            }


            int?IsValid = RequestParameters.PintNull("IsValid");
            if (IsValid != null)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "IsValid";
                whereCondition.FieldValue    = IsValid;
                whereCondition.FieldOperator = EnumOper.Equal;
                WhereList.Add(whereCondition);
            }
            string Remark = RequestParameters.Pstring("RemarkBySearch");
            if (Remark.Length > 0)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "Remark";
                whereCondition.FieldValue    = Remark;
                whereCondition.FieldOperator = EnumOper.Contains;
                WhereList.Add(whereCondition);
            }

            Guid CustomerID = RequestParameters.PGuid("CustomerID");
            if (CustomerID != Guid.Empty)
            {
                var whereCondition = new WhereCondition();
                whereCondition.FieldName     = "ID";
                whereCondition.FieldValue    = CustomerID;
                whereCondition.FieldOperator = EnumOper.DoubleEqual;
                WhereList.Add(whereCondition);
            }
            searchCondition.WhereList = WhereList;

            var    OrderList = new List <OrderCondition>();
            string sortfield = RequestParameters.Pstring("sortfield");
            if (sortfield.Length <= 0)
            {
                sortfield = "ID";
            }
            var orderCondition = new OrderCondition();
            orderCondition.FiledOrder = sortfield;
            orderCondition.Ascending  = true;
            OrderList.Add(orderCondition);

            searchCondition.OrderList = OrderList;
            #endregion

            var cBll = new CustomerBll();
            var list = cBll.SearchVByPageCondition(iPageIndex, iPageSize, ref iTotalRecord, searchCondition);
            iPageSize = iPageSize == 0 ? iTotalRecord : iPageSize;
            int pageCount    = iTotalRecord % iPageSize == 0 ? iTotalRecord / iPageSize : iTotalRecord / iPageSize + 1;
            var sReturnModel = new ResultList();
            sReturnModel.ErrorType   = 1;
            sReturnModel.CurrentPage = iCurrentPage;
            sReturnModel.PageSize    = iPageSize;
            sReturnModel.TotalRecord = iTotalRecord;
            sReturnModel.PageCount   = pageCount;
            sReturnModel.Data        = list;
            return(Json(sReturnModel, JsonRequestBehavior.AllowGet));
        }
示例#25
0
        public JsonResult ListPhyDelOld()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.PhyDelete;
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            string _ids = RequestParameters.Pstring("ids");
            if (string.IsNullOrEmpty(_ids))
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            string[] strids = _ids.Split(',');
            System.Collections.ArrayList arrayList = new System.Collections.ArrayList();
            for (int i = 0; i < strids.Length; i++)
            {
                if (RegexValidate.IsGuid(strids[i]))
                {
                    arrayList.Add(strids[i]);
                }
            }
            string[] ids = (string[])arrayList.ToArray(typeof(string));
            if (!ids.Any())
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            string   _bedIds   = RequestParameters.Pstring("bedIds");
            string[] strbedIds = _bedIds.Split(',');
            System.Collections.ArrayList arrayBedIdList = new System.Collections.ArrayList();
            for (int i = 0; i < strbedIds.Length; i++)
            {
                if (RegexValidate.IsGuid(strbedIds[i]))
                {
                    ParamID += strids[i] + ",";
                    arrayBedIdList.Add(strbedIds[i]);
                }
            }
            string[] bedIds          = (string[])arrayBedIdList.ToArray(typeof(string));
            var      welfareCentreId = Utits.WelfareCentreID;
            var      cBll            = new CustomerBll();
            bool     isFlag          = cBll.PhysicalDeleteByCondition(ids);
            if (isFlag)
            {
                ////BedStatus 1 有人住,0 没人住
                //var bedBll = new BedBll();
                //bedBll.OperateBedStatus(bedIds, 0, welfareCentreId);

                ParamState = "4";
                var cLog = new LogsBll();
                cLog.Log(ParamID.TrimEnd(','), ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
示例#26
0
        public JsonResult ListOperateStatus()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int[] iRangeButton       = { (int)EButtonType.CustomerLeave, (int)EButtonType.Enable, (int)EButtonType.Disable };
            int   iCurrentButtonId   = RequestParameters.Pint("oButtonId");
            var   tempNoAuth         = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iRangeButton, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            var customerId = RequestParameters.PGuid("ids");
            if (customerId == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            var bedId = RequestParameters.PGuid("bedIds");
            if (bedId == Guid.Empty)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "参数错误.";
                return(Json(sRetrunModel));
            }
            var welfareCentreId = Utits.WelfareCentreID;

            var  cBll   = new CustomerBll();
            bool isFlag = false;
            switch (iCurrentButtonId)
            {
            case (int)EButtonType.CustomerLeave:    //删除
                ParamState = "3";
                isFlag     = cBll.OperateDataStatus(customerId, bedId, welfareCentreId, (int)ESystemStatus.Deleted);
                break;

            case (int)EButtonType.Enable:    //启用
                ParamState = "5";
                isFlag     = cBll.OperateDataStatus(customerId, bedId, welfareCentreId, (int)ESystemStatus.Valid);
                break;

            case (int)EButtonType.Disable:    //禁用
                ParamState = "6";
                isFlag     = cBll.OperateDataStatus(customerId, bedId, welfareCentreId, (int)ESystemStatus.Forbidden);
                break;
            }
            if (isFlag)
            {
                ParamID = customerId.ToString();
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
        }
示例#27
0
        public string getCareContent(string bizContent, long timeStamp, string signature)
        {
            MessageLog.WriteLog(new LogParameterModel
            {
                ClassName        = this.GetType().ToString(),
                MethodName       = "getCareContent",
                MethodParameters = $"bizContent:{bizContent},timeStamp:{timeStamp},signature:{signature}",
                LogLevel         = ELogLevel.Info,
                Message          = "接收参数",
                PathPrefix       = "/log/ws",
                LogExt           = "txt"
            });
            var result    = new GetNursingVo();
            var paramItem = CommonLib.JsonHelper.Deserialize <GetNursingDto>(bizContent);

            if (paramItem == null)
            {
                result.resultCode    = 0;
                result.resultMessage = "操作失败:bizContent不合法.";
                return(result.ToJSON());
            }
            var customerBll  = new CustomerBll();
            var itemCustomer = customerBll.GetVijObjectById(paramItem.welfareCentreId, paramItem.bedNumber);

            if (itemCustomer == null)
            {
                result.resultCode    = 0;
                result.resultMessage = "未获得信息.";
                return(result.ToJSON());
            }
            var prModel = new personModel();

            prModel.userId     = itemCustomer.ID;
            prModel.personName = itemCustomer.CustomerName;
            prModel.age        = itemCustomer.CustomerAge ?? 0;
            prModel.gender     = itemCustomer.CustomerGender == 1 ? "男" : "女";

            var bufRemark = "";
            var iteRemark = new PaymentPlanBll().GetById(itemCustomer.WelfareCentreID, itemCustomer.ID);

            if (iteRemark != null)
            {
                bufRemark = iteRemark.Remark;
            }
            prModel.remark = bufRemark.ToString();
            result.person  = prModel;

            var          listNursing    = new List <nursingModel>();
            var          fatherId       = 1;
            var          nursingRankBll = new NursingRankBll();
            nursingModel itemNModel;
            var          listNurs = nursingRankBll.SearchListByWhole(fatherId, paramItem.welfareCentreId);

            foreach (var itemInfo in listNurs)
            {
                itemNModel = new nursingModel();
                itemNModel.nursingContent = itemInfo.RankContent;
                itemNModel.nursingId      = itemInfo.ID;
                itemNModel.fatherId       = itemInfo.ParentID ?? 0;
                itemNModel.nursingImgUrl  = itemInfo.RankImgUrl;
                listNursing.Add(itemNModel);
            }
            result.nursing       = listNursing;
            result.resultCode    = 1;
            result.resultMessage = "操作成功.";
            return(result.ToJSON());
        }
示例#28
0
        public string AddModels(string UserCode, string CipherPassword, int ModelType,
                                string StrAccID, string Act, string Entity)
        {
            //Entity = System.Web.HttpUtility.UrlDecode(Entity);
            string plainPassword = DefineEncryptDecrypt.Decrypt(CipherPassword);
            int    AccYear       = U8BllBase.GetBeginYear(StrAccID);

            if (AccYear == 0)
            {
                return(ControllerHelp.GetReturnStr(0, string.Format("没有找到账套号:{0}", StrAccID)));
            }
            int        success = 0;
            ModelsType mt      = (ModelsType)ModelType;

            switch (mt)
            {
            case ModelsType.Sale:     // 销售订单
                lock (SaleLock)
                {
                    if (Act == "add")
                    {
                        EntitySaleHead entity = JsonConvert.DeserializeObject <EntitySaleHead>(Entity);
                        SoMainBll      bll    = new SoMainBll(StrAccID, AccYear, UserCode, plainPassword);
                        var            result = bll.AddSale(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord09:     // 配送出库单(其他出库单)
                lock (RdRecord09Lock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord09Head entity = JsonConvert.DeserializeObject <EntityRdRecord09Head>(Entity);
                        RdRecord09Bll        bll    = new RdRecord09Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord09(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.DispatchList1:    //销售退货单
            case ModelsType.DispatchList4:    //委托代销退货单
                lock (DispatchList1Lock)
                {
                    if (Act == "add")
                    {
                        EntityDispatchListHead entity = JsonConvert.DeserializeObject <EntityDispatchListHead>(Entity);
                        DispatchListBll        bll    = new DispatchListBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddDispatchList(UserCode, plainPassword, StrAccID, AccYear, Act, ModelsType.DispatchList1 == mt ? 0 : 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.DispatchList2:    //销售发货单
            case ModelsType.DispatchList3:    //委托代销发货单
                lock (DispatchList2Lock)
                {
                    if (Act == "add")
                    {
                        EntityDispatchListHead entity = JsonConvert.DeserializeObject <EntityDispatchListHead>(Entity);
                        DispatchListBll        bll    = new DispatchListBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddDispatchList(UserCode, plainPassword, ModelType, StrAccID, AccYear, Act, ModelsType.DispatchList2 == mt ? 0 : 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Ap_CloseBill:    //收款单
                lock (Ap_CloseBillLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_CloseBillHead entity = JsonConvert.DeserializeObject <EntityAp_CloseBillHead>(Entity);
                        Ap_CloseBillBll        bll    = new Ap_CloseBillBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_CloseBill(UserCode, plainPassword, StrAccID, AccYear, Act, ModelType, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Ap_Vouch:    //其他应付款
                lock (Ap_VouchLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_VouchHead entity = JsonConvert.DeserializeObject <EntityAp_VouchHead>(Entity);
                        Ap_VouchBll        bll    = new Ap_VouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_Vouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.PO_Pomain:    //采购订单
                lock (PO_PomainLock)
                {
                    if (Act == "add")
                    {
                        EntityPO_Pomain entity = JsonConvert.DeserializeObject <EntityPO_Pomain>(Entity);
                        PO_PomainBll    bll    = new PO_PomainBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddPO_Pomain(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord01:    //采购入库单
                lock (RdRecord01Lock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord01Head entity = JsonConvert.DeserializeObject <EntityRdRecord01Head>(Entity);
                        RdRecord01Bll        bll    = new RdRecord01Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord01(UserCode, plainPassword, StrAccID, AccYear, Act, 0, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.PayAp_CloseBill:     //付款单
                lock (PayAp_CloseBillLock)
                {
                    if (Act == "add")
                    {
                        EntityAp_CloseBillHead entity = JsonConvert.DeserializeObject <EntityAp_CloseBillHead>(Entity);
                        Ap_CloseBillBll        bll    = new Ap_CloseBillBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddAp_CloseBill(UserCode, plainPassword, StrAccID, AccYear, Act, ModelType, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.ST_AppTransVouch:     //调拨申请单
                lock (ST_AppTransVouchLock)
                {
                    if (Act == "add")
                    {
                        EntityST_AppTransVouch entity = JsonConvert.DeserializeObject <EntityST_AppTransVouch>(Entity);
                        ST_AppTransVouchBll    bll    = new ST_AppTransVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddST_AppTransVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.TransVouch:     //调拨单
                lock (TransVouchLock)
                {
                    if (Act == "add")
                    {
                        EntityTransVouch entity = JsonConvert.DeserializeObject <EntityTransVouch>(Entity);
                        TransVouchBll    bll    = new TransVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddTransVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Vendor:     //供应商
                lock (VendorLock)
                {
                    if (Act == "add")
                    {
                        EntityVendor entity = JsonConvert.DeserializeObject <EntityVendor>(Entity);
                        VendorBll    bll    = new VendorBll(StrAccID, AccYear, UserCode, plainPassword);
                        var          result = bll.AddVendor(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.CheckVouch:     //盘点单
                lock (VendorLock)
                {
                    if (Act == "add")
                    {
                        EntityCheckVouchHead entity = JsonConvert.DeserializeObject <EntityCheckVouchHead>(Entity);
                        CheckVouchBll        bll    = new CheckVouchBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddCheckVouch(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.InventoryClass:     //存货分类
                lock (InventoryClassLock)
                {
                    if (Act == "add")
                    {
                        EntityInventoryClass entity = JsonConvert.DeserializeObject <EntityInventoryClass>(Entity);
                        InventoryClassBll    bll    = new InventoryClassBll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddInventoryClass(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Inventory:     //存货档案
                lock (InventoryLock)
                {
                    if (Act == "add")
                    {
                        EntityInventory entity = JsonConvert.DeserializeObject <EntityInventory>(Entity);
                        InventoryBll    bll    = new InventoryBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddInventory(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.WareHouse:     //仓库档案
                lock (WareHouseLock)
                {
                    if (Act == "add")
                    {
                        EntityWareHouse entity = JsonConvert.DeserializeObject <EntityWareHouse>(Entity);
                        WareHouseBll    bll    = new WareHouseBll(StrAccID, AccYear, UserCode, plainPassword);
                        var             result = bll.AddWareHouse(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.Customer:     //客户档案
                lock (CustomerLock)
                {
                    if (Act == "add")
                    {
                        EntityCustomer entity = JsonConvert.DeserializeObject <EntityCustomer>(Entity);
                        CustomerBll    bll    = new CustomerBll(StrAccID, AccYear, UserCode, plainPassword);
                        var            result = bll.AddCustomer(UserCode, plainPassword, StrAccID, AccYear, Act, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }

            case ModelsType.RdRecord01T:    //红字采购入库单
                lock (RdRecord01TLock)
                {
                    if (Act == "add")
                    {
                        EntityRdRecord01Head entity = JsonConvert.DeserializeObject <EntityRdRecord01Head>(Entity);
                        RdRecord01Bll        bll    = new RdRecord01Bll(StrAccID, AccYear, UserCode, plainPassword);
                        var result = bll.AddRdRecord01(UserCode, plainPassword, StrAccID, AccYear, Act, 1, entity, out success);
                        return(ControllerHelp.GetReturnStr(success, StrAccID + '_' + result));
                    }
                    break;
                }
            }

            return(ControllerHelp.GetReturnStr(0, "AddModels中没有找到可对应的操作项"));
        }
示例#29
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                TransactionBll transaction = new TransactionBll();

                transaction.type = lblPurchaseandsales.Text;

                string deacustman = txt_name.Text;

                CustomerBll dc = dl.GetCustomerIDFromname(deacustman);

                transaction.dea_cust_id      = dc.id;
                transaction.grandTotal       = decimal.Parse(txt_grand.Text);
                transaction.transaction_date = DateTime.Now;
                transaction.tax      = decimal.Parse(txt_vat.Text);
                transaction.discount = decimal.Parse(txt_discount.Text);

                string loggedUser = Login.loggein;
                usebll usr        = Dal.GetIDFromUsername(loggedUser);
                transaction.added_by = usr.id;

                transaction.transactionDetails = transactionDT;

                bool success = false;

                using (TransactionScope scope = new TransactionScope())
                {
                    int transactionID = -1;

                    bool w = tdal.Insert_transaction(transaction, out transactionID);


                    for (int i = 0; i < transactionDT.Rows.Count; i++)
                    {
                        TransactionDetailsBll transactiondetails = new TransactionDetailsBll();

                        string     Productname = txt_productnname.Text;
                        Productbll p           = Pl.GetProductIDFromName(Productname);


                        string transactionType = lblPurchaseandsales.Text;


                        transactiondetails.ProductID   = p.id;
                        transactiondetails.rate        = decimal.Parse(transactionDT.Rows[i][1].ToString());
                        transactiondetails.qty         = decimal.Parse(transactionDT.Rows[i][2].ToString());
                        transactiondetails.total       = decimal.Parse(transactionDT.Rows[i][3].ToString());
                        transactiondetails.dea_cust_id = dc.id;
                        transactiondetails.added_date  = DateTime.Now;
                        transactiondetails.added_by    = usr.id;
                        bool x = false;
                        if (transactionType == "Purchase")
                        {
                            x = Pl.IncreaseProduct(transactiondetails.ProductID, transactiondetails.qty);
                        }
                        else if (transactionType == "Sales")
                        {
                            x = Pl.DecreaseProduct(transactiondetails.ProductID, transactiondetails.qty);
                        }


                        bool y = tdetailDAL.insertTransactionDetails(transactiondetails);

                        success = w & y;

                        if (success == true)
                        {
                            scope.Complete();


                            MessageBox.Show("Transaction Completed Successfully");
                        }
                        else
                        {
                            MessageBox.Show("Transaction Failed");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#30
0
        public JsonResult AddOrUpdate()
        {
            #region 权限控制
            int[] iRangePage         = { AddPageNodeId, EditPageNodeId, DetailPageNodeId };
            int   iCurrentPageNodeId = AddPageNodeId;
            int   iCurrentButtonId   = (int)EButtonType.Save;


            var tempNoAuth = Utits.IsOperateAuth(iRangePage, iCurrentPageNodeId, iCurrentButtonId);
            if (tempNoAuth.ErrorType != 1)
            {
                return(Json(tempNoAuth));
            }
            #endregion

            #region AddOrUpdate
            Guid     ID              = RequestParameters.PGuid("ID");
            Guid     ddlOrgID        = RequestParameters.PGuid("ddlOrgID");
            string   CustomerName    = RequestParameters.Pstring("CustomerName");
            int      Age             = RequestParameters.Pint("Age");
            int      CustomerGender  = RequestParameters.Pint("CustomerGender");
            string   CustomerWedlock = RequestParameters.Pstring("CustomerWedlock");
            string   CustomerJG      = RequestParameters.Pstring("CustomerJG");
            string   Address         = RequestParameters.Pstring("Address");
            string   Company         = RequestParameters.Pstring("Company");
            string   Phone           = RequestParameters.Pstring("Phone");
            string   CustomerGSR     = RequestParameters.Pstring("CustomerGSR");
            DateTime?AdmissionDate   = RequestParameters.PDateTime("AdmissionDate");
            DateTime?DiagnosticDate  = RequestParameters.PDateTime("DiagnosticDate");

            string   CustomerJJYW     = RequestParameters.Pstring("CustomerJJYW");
            string   CustomerJJSW     = RequestParameters.Pstring("CustomerJJSW");
            int?     CustomerYSLX_dic = RequestParameters.PintNull("CustomerYSLX_dic");
            string   CustomerYYBH     = RequestParameters.Pstring("CustomerYYBH");
            string   CustomerSFWWYY   = RequestParameters.Pstring("CustomerSFWWYY");
            int?     CustomerHLMC_dic = RequestParameters.PintNull("CustomerHLMC_dic");
            string   CustomerCardID   = RequestParameters.Pstring("CustomerCardID");
            int?     CustomerType_dic = RequestParameters.PintNull("CustomerType_dic");
            string   CustomerSBKH     = RequestParameters.Pstring("CustomerSBKH");
            string   CustomerMZ       = RequestParameters.Pstring("CustomerMZ");
            int?     CustomerWHCD_dic = RequestParameters.PintNull("CustomerWHCD_dic");
            string   CustomerZW       = RequestParameters.Pstring("CustomerZW");
            int      CustomerYLJSR    = RequestParameters.Pint("CustomerYLJSR");
            string   CustomerZZDH     = RequestParameters.Pstring("CustomerZZDH");
            string   CustomerYYZT     = RequestParameters.Pstring("CustomerYYZT");
            string   CustomerSFBS     = RequestParameters.Pstring("CustomerSFBS");
            string   CustomerSX       = RequestParameters.Pstring("CustomerSX");
            string   CustomerZYBH     = RequestParameters.Pstring("CustomerZYBH");
            DateTime?CustomerYYSJ     = RequestParameters.PDateTime("CustomerYYSJ");
            DateTime?CustomerLYSJ     = RequestParameters.PDateTime("CustomerLYSJ");
            string   CustomerLYYY     = RequestParameters.Pstring("CustomerLYYY");
            string   CustomerYLBZ     = RequestParameters.Pstring("CustomerYLBZ");
            string   CustomerXMPY     = GetSpellCode(CustomerName);
            DateTime?CustomerBrith    = RequestParameters.PDateTime("CustomerBrith");
            Guid     oldBednoID       = RequestParameters.PGuid("oldBednoID");
            Guid     bednoID          = RequestParameters.PGuid("bednoID");
            string   BedNumberName    = RequestParameters.Pstring("BedNumberName");
            string   bednoText        = RequestParameters.Pstring("bednoText");
            string   HeadImg          = RequestParameters.Pstring("HeadImg");

            string CustomerZZMM        = RequestParameters.Pstring("CustomerZZMM");
            string CustomerJYCD        = RequestParameters.Pstring("CustomerJYCD");
            string CustomerDlrXm       = RequestParameters.Pstring("CustomerDlrXm");
            string CustomerDlrTel      = RequestParameters.Pstring("CustomerDlrTel");
            string CustomerDlrDz       = RequestParameters.Pstring("CustomerDlrDz");
            string CustomerDlrGx       = RequestParameters.Pstring("CustomerDlrGx");
            string CustomerDlrYb       = RequestParameters.Pstring("CustomerDlrYb");
            string ddlCustomerHJDQ_dic = RequestParameters.Pstring("CustomerHJDQ_dic");
            var    cBll = new CustomerBll();
            #region  判断
            if (CustomerName.Length <= 0)
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "姓名不能为空.";
                return(Json(sRetrunModel));
            }
            //var welfareCentreId = Utits.WelfareCentreID;
            //if (bednoID != Guid.Empty)
            //{
            //    bool isFlagValidation = false;
            //    if (ID == Guid.Empty)
            //        isFlagValidation = cBll.ValidationBedByCustomer(bednoID, welfareCentreId);
            //    else
            //        isFlagValidation = cBll.ValidationBedByCustomer(ID, bednoID, welfareCentreId);

            //    if (!isFlagValidation)
            //    {
            //        var sRetrunModel = new ResultMessage();
            //        sRetrunModel.ErrorType = 0;
            //        sRetrunModel.MessageContent = "床位已住人.";
            //        return Json(sRetrunModel);
            //    }
            //}
            #endregion

            var item = new tbCustomer();
            item.ID = ID;

            ParamState = "1";
            ParamID    = item.ID.ToString();

            item.Stage           = (int)ECustomerType.RuYuan;
            item.OperateDate     = DateTime.Now;
            item.CustomerName    = CustomerName;
            item.BedNumber       = bednoID == Guid.Empty ? "" : bednoText;
            item.BedID           = bednoID;
            item.CustomerGender  = CustomerGender;
            item.CustomerWedlock = CustomerWedlock;
            item.CustomerAge     = Age;
            item.CustomerJG      = CustomerJG;
            item.CustomerAddress = Address;
            item.CustomerCompany = Company;
            item.CustomerTel     = Phone;
            item.CustomerGSR     = CustomerGSR;
            item.AdmissionDate   = AdmissionDate ?? DateTime.Now;
            item.DiagnosticDate  = DiagnosticDate ?? DateTime.Now;

            item.CustomerCardID   = CustomerCardID;
            item.CustomerType_dic = CustomerType_dic;
            item.CustomerSBKH     = CustomerSBKH;
            item.CustomerMZ       = CustomerMZ;
            item.CustomerWHCD_dic = CustomerWHCD_dic;
            item.CustomerZW       = CustomerZW;
            item.CustomerYLJSR    = CustomerYLJSR;
            item.CustomerZZDH     = CustomerZZDH;
            item.CustomerYYZT     = CustomerYYZT;
            item.CustomerSFBS     = CustomerSFBS;
            item.CustomerSX       = CustomerSX;
            item.CustomerXMPY     = CustomerXMPY;//姓名拼音
            item.CustomerZYBH     = CustomerZYBH;
            item.CustomerYYSJ     = CustomerYYSJ;
            item.CustomerLYSJ     = CustomerLYSJ;
            item.CustomerLYYY     = CustomerLYYY;
            item.CustomerYLBZ     = CustomerYLBZ;
            item.CustomerJJYW     = CustomerJJYW;
            item.CustomerJJSW     = CustomerJJSW;
            item.CustomerYSLX_dic = CustomerYSLX_dic;
            item.CustomerYYBH     = CustomerYYBH;
            item.CustomerSFWWYY   = CustomerSFWWYY;
            item.CustomerHLMC_dic = CustomerHLMC_dic;
            item.CustomerBrith    = CustomerBrith;
            item.BedNumberName    = BedNumberName;
            item.CustomerHeadImg  = HeadImg;

            item.CustomerZZMM     = CustomerZZMM;
            item.CustomerJYCD     = CustomerJYCD;
            item.CustomerDlrXm    = CustomerDlrXm;
            item.CustomerDlrTel   = CustomerDlrTel;
            item.CustomerDlrDz    = CustomerDlrDz;
            item.CustomerDlrGx    = CustomerDlrGx;
            item.CustomerDlrYb    = CustomerDlrYb;
            item.CustomerHJDQ_dic = ddlCustomerHJDQ_dic;
            //item.WelfareCentreID = welfareCentreId;
            item.WelfareCentreID = ddlOrgID;
            bool IsFlag = cBll.AddOrUpdate(item, oldBednoID);
            //if (bednoID != oldBednoID)
            //{
            //    //BedStatus 1 有人住,0 没人住
            //    if (bednoID!=Guid.Empty)
            //    {
            //        var bedBll = new BedBll();
            //        bool IsBedFlag = bedBll.OperateBedStatus(bednoID,1);
            //    }
            //    if (oldBednoID != Guid.Empty)
            //    {
            //        var bedBll = new BedBll();
            //        bool IsBedFlag = bedBll.OperateBedStatus(oldBednoID, 0);
            //    }
            //}
            if (IsFlag)
            {
                var cLog = new LogsBll();
                cLog.Log(ParamID, ParamName, ParamState, Utits.CurrentUserID.ToString(), Utits.CurrentRealName.ToString(), Utits.WelfareCentreID.ToString(), Utits.ClientIPAddress.ToString());

                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 1;
                sRetrunModel.MessageContent = "操作成功.";
                return(Json(sRetrunModel));
            }
            else
            {
                var sRetrunModel = new ResultMessage();
                sRetrunModel.ErrorType      = 0;
                sRetrunModel.MessageContent = "操作失败.";
                return(Json(sRetrunModel));
            }
            #endregion
        }