protected void save_open_Click(object sender, EventArgs e) { var param = GetSales(); param = LocationDeal(param); var result = new SaleOrderBLL().EditSaleOrder(param, GetUdfValue(), GetLoginUserId()); switch (result) { case ERROR_CODE.SUCCESS: Response.Write("<script>alert('修改销售订单成功!');window.close();window.open('SaleOrderView.aspx?id=" + sale_order.id + "','" + (int)EMT.DoneNOW.DTO.OpenWindow.SaleOrderView + "','left=200,top=200,width=900,height=750', false);</script>"); break; case ERROR_CODE.PARAMS_ERROR: ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('必填参数丢失,请重新填写!');</script>"); break; case ERROR_CODE.USER_NOT_FIND: Response.Write("<script>alert('查询不到用户,请重新登陆');</script>"); Response.Redirect("../Login.aspx"); break; default: break; } }
protected void save_close_Click(object sender, EventArgs e) { var param = GetSales(); param = LocationDeal(param); var result = new SaleOrderBLL().EditSaleOrder(param, GetUdfValue(), GetLoginUserId()); switch (result) { case ERROR_CODE.SUCCESS: ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('修改销售订单成功!');window.close();</script>"); break; case ERROR_CODE.PARAMS_ERROR: ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('必填参数丢失,请重新填写!');</script>"); break; case ERROR_CODE.USER_NOT_FIND: Response.Write("<script>alert('查询不到用户,请重新登陆');</script>"); Response.Redirect("../Login.aspx"); break; default: break; } }
/// <summary> /// 通过成本完成销售订单 /// </summary> /// <param name="context"></param> private void DoneCostSale(HttpContext context) { var result = true; var thisCostId = context.Request.QueryString["costId"]; if (!string.IsNullOrEmpty(thisCostId)) { result = new SaleOrderBLL().DoneSaleByCost(long.Parse(thisCostId), LoginUserId); } context.Response.Write(result); }
/// <summary> /// 删除员工销售目标 /// </summary> void DeleteQuota(HttpContext context) { bool result = false; long id = 0; if (!string.IsNullOrEmpty(context.Request.QueryString["id"]) && long.TryParse(context.Request.QueryString["id"], out id)) { result = new SaleOrderBLL().DeleteQuota(id, LoginUserId); } WriteResponseJson(result); }
/// <summary> /// 更改销售订单的状态 /// </summary> /// <param name="context"></param> /// <param name="soid"></param> /// <param name="status_id"></param> private void ChangeSaleOrderStatus(HttpContext context, long soid, int status_id) { if (status_id == 469) { if (AuthBLL.GetUserSaleorderAuth(LoginUserId, LoginUser.security_Level_id, soid).CanDelete == false) { return; } } var result = new SaleOrderBLL().UpdateSaleOrderStatus(soid, status_id, LoginUserId); context.Response.Write(result); }
protected void Page_Load(object sender, EventArgs e) { actionTypeList = bll.GetCRMActionType(); resourceList = new UserResourceBLL().GetResourceList(); if (!IsPostBack) { long noteid; if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out noteid)) { if (AuthBLL.GetUserTodoAuth(LoginUserId, LoginUser.security_Level_id, noteid).CanEdit == false) { Response.Write("<script>alert('您不能编辑此待办');</script>"); Response.End(); return; } note = bll.GetActivity(noteid); contactList = new ContactBLL().GetContactByCompany((long)note.account_id); opportunityList = new OpportunityBLL().GetOpportunityByCompany((long)note.account_id); #region 记录浏览历史 var accountName = ""; if (note.account_id != null) { var account = new CompanyBLL().GetCompany((long)note.account_id); accountName = account == null ? "" : account.name; } var history = new sys_windows_history() { title = "待办:" + note.description + ":" + accountName, url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); #endregion } if (long.TryParse(Request.QueryString["accountId"], out accountId)) { objType = (int)DicEnum.OBJECT_TYPE.CUSTOMER; objId = accountId; } if (long.TryParse(Request.QueryString["contactId"], out contactId)) { accountId = new ContactBLL().GetContact(contactId).account_id; objType = (int)DicEnum.OBJECT_TYPE.CONTACT; objId = contactId; } if (long.TryParse(Request.QueryString["opportunityId"], out opportunityId)) { objType = (int)DicEnum.OBJECT_TYPE.OPPORTUNITY; objId = opportunityId; var opp = new OpportunityBLL().GetOpportunity(opportunityId).general; accountId = opp.account_id; if (opp.contact_id != null) { contactId = (long)opp.contact_id; } } if (long.TryParse(Request.QueryString["saleorderId"], out saleOrderId)) { objType = (int)DicEnum.OBJECT_TYPE.SALEORDER; objId = saleOrderId; var saleOrder = new SaleOrderBLL().GetSaleOrder(saleOrderId); var opp = new OpportunityBLL().GetOpportunity(saleOrder.opportunity_id).general; opportunityId = opp.id; accountId = opp.account_id; if (opp.contact_id != null) { contactId = (long)opp.contact_id; } } if (long.TryParse(Request.QueryString["ticketId"], out ticketId)) { objType = (int)DicEnum.OBJECT_TYPE.TICKETS; objId = ticketId; ticket = new DAL.sdk_task_dal().FindNoDeleteById(ticketId); accountId = ticket.account_id; if (ticket.contact_id != null) { contactId = (long)ticket.contact_id; } if (ticket.opportunity_id != null) { opportunityId = (long)ticket.opportunity_id; } } } else { com_activity activity = AssembleModel <com_activity>(); if (activity.contact_id == 0) { activity.contact_id = null; } activity.start_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["start_date2"])); activity.end_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["end_date2"])); if (!string.IsNullOrEmpty(Request.Form["is_completed"]) && Request.Form["is_completed"].Equals("on")) { activity.status_id = (int)DicEnum.ACTIVITY_STATUS.COMPLETED; activity.complete_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["complete_time1"])); } else { activity.status_id = (int)DicEnum.ACTIVITY_STATUS.NOT_COMPLETED; activity.complete_description = null; } if (string.IsNullOrEmpty(Request.Form["id"])) { bll.AddTodo(activity, GetLoginUserId()); } else { bll.EditTodo(activity, GetLoginUserId()); } if (Request.Form["action"] != null && Request.Form["action"].Equals("SaveNew")) { Response.Write("<script>alert('保存待办成功');window.location.href='Notes.aspx';self.opener.location.reload();</script>"); } else { Response.Write("<script>alert('保存待办成功');window.close();self.opener.location.reload();</script>"); } } }
protected void Page_Load(object sender, EventArgs e) { thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId); actionTypeList = bll.GetCRMActionType(); resourceList = new UserResourceBLL().GetResourceList(); if (!IsPostBack) { long noteid; if (!string.IsNullOrEmpty(Request.QueryString["id"]) && long.TryParse(Request.QueryString["id"], out noteid)) { if (AuthBLL.GetUserNoteAuth(LoginUserId, LoginUser.security_Level_id, noteid).CanEdit == false) { Response.Write("<script>alert('您不能编辑此备注');</script>"); Response.End(); return; } note = bll.GetActivity(noteid); contactList = new ContactBLL().GetContactByCompany((long)note.account_id); opportunityList = new OpportunityBLL().GetOpportunityByCompany((long)note.account_id); var accountName = ""; if (note.account_id != null) { var account = new CompanyBLL().GetCompany((long)note.account_id); accountName = account == null ? "" : account.name; } var history = new sys_windows_history() { title = "备注:" + note.description + ":" + accountName, url = Request.RawUrl, }; new IndexBLL().BrowseHistory(history, LoginUserId); } if (long.TryParse(Request.QueryString["accountId"], out accountId)) { objType = (int)DicEnum.OBJECT_TYPE.CUSTOMER; objId = accountId; } if (long.TryParse(Request.QueryString["contactId"], out contactId)) { accountId = new ContactBLL().GetContact(contactId).account_id; objType = (int)DicEnum.OBJECT_TYPE.CONTACT; objId = contactId; } if (long.TryParse(Request.QueryString["opportunityId"], out opportunityId)) { objType = (int)DicEnum.OBJECT_TYPE.OPPORTUNITY; objId = opportunityId; var opp = new OpportunityBLL().GetOpportunity(opportunityId).general; accountId = opp.account_id; if (opp.contact_id != null) { contactId = (long)opp.contact_id; } } if (long.TryParse(Request.QueryString["saleorderId"], out saleOrderId)) { objType = (int)DicEnum.OBJECT_TYPE.SALEORDER; objId = saleOrderId; var saleOrder = new SaleOrderBLL().GetSaleOrder(saleOrderId); var opp = new OpportunityBLL().GetOpportunity(saleOrder.opportunity_id).general; opportunityId = opp.id; accountId = opp.account_id; if (opp.contact_id != null) { contactId = (long)opp.contact_id; } } } else { com_activity activity = AssembleModel <com_activity>(); if (activity.contact_id == 0) { activity.contact_id = null; } activity.start_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["start_date2"])); activity.end_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["end_date2"])); com_activity todo = null; if (!string.IsNullOrEmpty(Request.Form["action_type_id1"])) { todo = new com_activity(); todo.action_type_id = int.Parse(Request.Form["action_type_id1"]); todo.start_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["start_date1"])); todo.end_date = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Parse(Request.Form["end_date1"])); todo.description = Request.Form["description1"]; if (!string.IsNullOrEmpty(Request.Form["resource_id1"])) { todo.resource_id = long.Parse(Request.Form["resource_id1"]); } } if (string.IsNullOrEmpty(Request.Form["id"])) { bll.AddCRMNote(activity, todo, GetLoginUserId()); } else { bll.EditCRMNote(activity, todo, GetLoginUserId()); } if (Request.Form["action"] != null && Request.Form["action"].Equals("SaveNew")) { Response.Write("<script>alert('保存备注成功');window.location.href='Notes.aspx';self.opener.location.reload();</script>"); } else { Response.Write("<script>alert('保存备注成功');window.close();self.opener.location.reload();</script>"); } } }
public ActionResult GetWayBill(string orderNo, string shipTypeCode) { SaleOrderBLL saleOrderBLL = new SaleOrderBLL(); var saleOrder = saleOrderBLL.GetSaleOrder(orderNo); var saleOrderItem = saleOrderBLL.GetOrderItemList(orderNo).FirstOrDefault(); var appId = "1276314"; var appKey = "319ee1b5-d572-4eb6-b2b9-228076c48eec"; var url = "http://api.kdniao.cc/api/eorderservice"; var printServer = ExpressDockingFactory.GetKdNiaoExpressDocking(url); KdNiaoRequestData kdnrd = new KdNiaoRequestData(); kdnrd.AppKey = appKey; kdnrd.EBusinessID = appId; kdnrd.DataType = "2"; kdnrd.RequestType = "1007"; KdNiaoWaybillRequestDataContent kdnrdc = new KdNiaoWaybillRequestDataContent(); kdnrdc.Receiver = new KdNiaoAddress() { ProvinceName = saleOrder.Province, CityName = saleOrder.City, ExpAreaName = saleOrder.County, Address = saleOrder.ReceiveAddress, Name = saleOrder.ReceiveContact, Mobile = saleOrder.ReceiveCellPhone, PostCode = saleOrder.ReceiveZip }; var sendInfo = new WarehouseBLL().GetWarehouse(saleOrder.WarehouseId); var provinceCityBll = new BaseProvinceCityBll(); kdnrdc.Sender = new KdNiaoAddress() { ProvinceName = provinceCityBll.GetNameByCode(sendInfo.ProvinceId), CityName = provinceCityBll.GetNameByCode(sendInfo.CityId), ExpAreaName = provinceCityBll.GetNameByCode(sendInfo.CountyId), Address = sendInfo.Address, Name = sendInfo.Contact, Mobile = sendInfo.Phone, PostCode = sendInfo.PostalCode }; kdnrdc.Commodity = new List <KdNiaoCommodity>() { new KdNiaoCommodity() { GoodsName = saleOrderItem.ProductName, GoodsWeight = saleOrderItem.Weight.ToString(), Goodsquantity = saleOrderItem.QtyScaned.ToString(), GoodsVol = saleOrderItem.Volume.ToString() } }; kdnrdc.ShipperCode = shipTypeCode; kdnrdc.OrderCode = saleOrder.OrderNo; kdnrdc.ExpType = "1"; kdnrdc.PayType = "1"; kdnrdc.IsNotice = "1"; kdnrdc.IsReturnPrintTemplate = "1"; if (shipTypeCode == "YTO") { kdnrdc.CustomerName = "k210314881"; kdnrdc.MonthCode = "f2ar5n8b"; } kdnrd.RequestData = kdnrdc.ToJson(); kdnrd.RequestDataContent = kdnrdc; kdnrd.DataSign = Encrypt.KdNiaoSingEncrypt(kdnrd.RequestData, appKey, "UTF-8"); var kdnrp = printServer.GetWayBill(kdnrd); //if (!kdnrp.Success) //{ // return Content(kdnrp.ToJson()); //} return(Content(kdnrp.PrintTemplate)); }