/// <summary>
        /// 上传导入的文件
        /// </summary>
        /// <returns></returns>
        protected string up()
        {
            string path = Server.MapPath("../Template/");

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            if (fuimport.HasFile)
            {
                string name     = UserID.ToString().ToString() + "_TeacherTemplate_";
                string strfile  = System.IO.Path.GetExtension(fuimport.FileName);
                string filename = name + strfile;
                path += filename;
                fuimport.SaveAs(path);
                return(path);
            }
            else
            {
                return("");
            }
        }
Beispiel #2
0
        public ActionResult Create(Employee model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();
            var repo = new EmployeeRepository();

            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "Employee", "EmployeeName", model.EmployeeName, null, null);

            if (!isexists)
            {
                var result = new EmployeeRepository().Insert(model);
                if (result.EmployeeId > 0)
                {
                    TempData["Success"] = "Added Successfully!";
                    TempData["RefNo"]   = result.EmployeeRefNo;
                    return(RedirectToAction("Create"));
                }

                else
                {
                    FillDesignationDropdown();
                    FillCategoryDropdown();
                    FillLocationDropdown();
                    TempData["error"] = "Oops!!..Something Went Wrong!!";
                    TempData["RefNo"] = null;
                    return(View("Create", model));
                }
            }
            else
            {
                FillDesignationDropdown();
                FillCategoryDropdown();
                FillLocationDropdown();
                TempData["error"] = "This Name Alredy Exists!!";
                TempData["RefNo"] = null;
                return(View("Create", model));
            }
        }
Beispiel #3
0
        public ActionResult EnquiryBooking(EnquiryBooking model)
        {
            if (!ModelState.IsValid)
            {
                FillDropdowns();
                var allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(View(model));
            }
            model.CreatedBy      = UserID.ToString();
            model.CreatedDate    = System.DateTime.Now;
            model.OrganizationId = OrganizationId;
            var repo = new EnquiryBookingRepository();
            //bool isexists = repo.IsFieldExists(repo.ConnectionString(), "EnquiryBooking", "SubName", model.SubName, null, null);
            //if (!isexists)
            {
                var result = new EnquiryBookingRepository().Insert(model);
                if (result.EnquiryId > 0)
                {
                    TempData["Success"]    = "Added Successfully!";
                    TempData["EnquiryRef"] = result.EnquiryRef;
                    return(RedirectToAction("EnquiryBooking"));
                }

                else
                {
                    TempData["error"]      = "Oops!!..Something Went Wrong!!";
                    TempData["EnquiryRef"] = null;
                    return(View("EnquiryBooking", model));
                }
            }
            //else
            //{

            //    TempData["error"] = "This Name Alredy Exists!!";
            //    TempData["SubRefNo"] = null;
            //    return View("Create", model);
            //}
        }
Beispiel #4
0
        public ActionResult Create(PurchaseRequest model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(View(model));
                }
                model.OrganizationId = OrganizationId;
                model.CreatedDate    = System.DateTime.Now;
                model.CreatedBy      = UserID.ToString();

                string id = new PurchaseRequestRepository().InsertPurchaseRequest(model);
                if (id.Split('|')[0] != "0")
                {
                    TempData["success"] = "Saved successfully. Purchase Request Reference No. is " + id.Split('|')[1];
                    TempData["error"]   = "";
                    return(RedirectToAction("Pending"));
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (SqlException sx)
            {
                TempData["error"] = "Some error occured while connecting to database. Please check your network connection and try again.|" + sx.Message;
            }
            catch (NullReferenceException nx)
            {
                TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message;
            }
            catch (Exception ex)
            {
                TempData["error"] = "Some error occured. Please try again.|" + ex.Message;
            }
            return(RedirectToAction("Pending"));
        }
        public ActionResult Create(IList <ItemBatch> model)
        {
            HashSet <string> temp = new HashSet <string>();

            foreach (var item in model)
            {
                temp.Add(item.SerialNo);
            }
            if (temp.Count != model.Count)
            {
                TempData["error"] = "Serial numbers cannot be same. Please enter different serial numbers.";
                return(View(model));
            }
            foreach (ItemBatch item in model)
            {
                item.CreatedBy      = UserID.ToString();
                item.OrganizationId = OrganizationId;
                item.CreatedDate    = DateTime.Now;
            }
            try
            {
                string existingSerialNos = new ItemBatchRepository().IsSerialNoExists(model.Select(m => m.SerialNo).ToList());
                if (existingSerialNos == null)
                {
                    new ItemBatchRepository().InsertItemBatch(model);
                    TempData["success"] = "Saved successfully";
                    TempData["error"]   = "";
                    return(RedirectToAction("Pending", new { type = model[0].isOpeningStock }));
                }
                TempData["error"] = existingSerialNos + " already exists.";
            }
            catch (Exception ex)
            {
                TempData["success"] = "";
                TempData["error"]   = "Some error occured while connecting to database. Check your network connection and try again|" + ex.Message;
            }
            return(View(model));
        }
Beispiel #6
0
        public ActionResult Edit(Organization model)
        {
            var repo = new OrganizationRepository();

            model.CreatedBy = UserID.ToString();

            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "Organization", "OrganizationName", model.OrganizationName, "OrganizationId", model.OrganizationId);

            if (!isexists)
            {
                var result = new OrganizationRepository().UpdateOrganization(model);

                if (result.OrganizationId > 0)
                {
                    TempData["Success"]           = "Updated Successfully!";
                    TempData["OrganizationRefNo"] = result.OrganizationRefNo;
                    return(RedirectToAction("Create"));
                }
                else
                {
                    dropdown();
                    FillCountryDropdown();
                    FillCompanyDropdown();
                    TempData["error"]             = "Oops!!..Something Went Wrong!!";
                    TempData["OrganizationRefNo"] = null;
                    return(View("Edit", model));
                }
            }
            else
            {
                dropdown();
                FillCountryDropdown();
                FillCompanyDropdown();
                TempData["error"]             = "This Organization Name Alredy Exists!!";
                TempData["OrganizationRefNo"] = null;
                return(View("Create", model));
            }
        }
Beispiel #7
0
        //private ResultInfo Redirect2Pay(string desc, decimal fee, string payOrderID, string returnUrl, string notifyUrl, Action errorCallBack)
        private ResultInfo Redirect2Pay(string desc, decimal fee, string payOrderID, string returnUrl, string notifyUrl)
        {
            ResultInfo ri = new ResultInfo();

            DefaultAopClient        client      = new DefaultAopClient(AliPayConfig.gatewayUrl, AliPayConfig.app_id, AliPayConfig.private_key, "json", "1.0", AliPayConfig.sign_type, AliPayConfig.alipay_public_key, AliPayConfig.charset, false);
            AlipayTradePagePayModel alipayModel = new AlipayTradePagePayModel();

            alipayModel.Body        = desc;
            alipayModel.Subject     = desc;
            alipayModel.TotalAmount = fee.ToString();
            alipayModel.OutTradeNo  = payOrderID;
            alipayModel.ProductCode = "FAST_INSTANT_TRADE_PAY";

            AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();

            // 设置同步回调地址
            request.SetReturnUrl(returnUrl);
            // 设置异步通知接收地址
            request.SetNotifyUrl(notifyUrl);
            // 将业务model载入到request
            request.SetBizModel(alipayModel);

            AlipayTradePagePayResponse response = null;

            try
            {
                response = client.pageExecute(request, null, "post");
                ri.Ok    = true;
                ri.Url   = "/Pay/PayRedirect";
                Session["AliPayForm" + UserID.ToString()] = response.Body;
            }
            catch
            {
                ri.Msg = "支付过程中出现异常,请重试!";
                //errorCallBack();
            }
            return(ri);
        }
Beispiel #8
0
        public ActionResult SendAndNotice()
        {
            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("@smstitle", Request["title"] ?? "幼儿园通知");
            dict.Add("@content", Request["content"] ?? "");
            dict.Add("@img_url", Request["imgs"] ?? "");
            dict.Add("@audio_url", Request["audio"] ?? "");
            dict.Add("@video_url", Request["video"] ?? "");
            dict.Add("@senderuserid", UserID.ToString());
            dict.Add("@recuserid", string.Join(",", Request["teachers"].Split(',').Concat(Request["students"].Split(',')).ToArray()));
            dict.Add("@sendtime", (Request["istime"] ?? "0") == "0" ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : Request["sendtime"]);
            dict.Add("@istime", Request["istime"] ?? "0");
            dict.Add("@kid", Request["kid"] ?? "0");
            dict.Add("@smstype", Request["smstype"] ?? "1");//老师1园长2
            dict.Add("@appsend", "1");
            dict.Add("@receipttype", Request["receipt"] ?? "1");
            dict.Add("@messagetype", Request["messagetype"] ?? "1");
            dict.Add("@state", ((Request["role"] ?? "1") == "0") ? "1" : ((Request["needAudit"] ?? "1") == "0" ? "1" : "0"));
            DataSet ds = BaseDataProxy.GetDataSet(dict, "sms..Send_And_Notice_v2");

            return(Json(ds.Tables[0].Rows[0][0].ToString(), JsonRequestBehavior.AllowGet));
        }
Beispiel #9
0
        public ActionResult TeacherList()
        {
            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("@userid", UserID.ToString());
            dict.Add("@kid", Request["kid"]);
            DataSet ds = BaseDataProxy.GetDataSet(dict, "Basicdata..Teacher_Info_GetListV2");

            var departments = ds.Tables[0].AsEnumerable().Select(x => new
            {
                id   = x.Field <int>("did"),
                name = x.Field <string>("dname")
            }).Distinct().Select(x => new MemberList
            {
                id   = x.id,
                name = x.name
            }).ToList();
            var teachers = ds.Tables[0].ToObjectList <TeacherMember>();

            departments.ForEach(x => { x.member = (teachers.Where(a => a.did == x.id).OrderBy(a => a.username)).ToList <Member>(); });

            return(Json(departments, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Edit(WorkShopRequest model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();



            var repo = new WorkShopRequestRepository();

            try
            {
                new WorkShopRequestRepository().UpdateWorkShopRequest(model);
                TempData["success"] = "Updated Successfully (" + model.WorkShopRequestRefNo + ")";
                return(RedirectToAction("Index", new { isProjectBased = model.isProjectBased }));
            }
            catch (Exception)
            {
                TempData["error"] = "Some error occurred. Please try again.";
            }

            return(RedirectToAction("Index", new { isProjectBased = model.isProjectBased }));
        }
 public ActionResult Complete(ProjectCompletion model)
 {
     try
     {
         model.CreatedBy = UserID.ToString(); model.CreatedDate = DateTime.Today; model.OrganizationId = OrganizationId;
         if (model.ItemBatches != null && model.ItemBatches.Count > 0)
         {
             foreach (ItemBatch item in model.ItemBatches)
             {
                 item.WarrantyStartDate  = model.ProjectCompletionDate;
                 item.WarrantyExpireDate = model.ProjectCompletionDate.AddMonths(item.WarrantyPeriodInMonths ?? 0).AddDays(-1);
             }
         }
         string ref_no = new ProjectCompletionRepository().InsertProjectCompletion(model);
         TempData["success"] = "Saved Successfully. Reference No. is " + ref_no;
         return(RedirectToAction("Pending"));
     }
     catch (Exception)
     {
         TempData["error"] = "Some error occured. Please try agian.";
     }
     return(View(model));
 }
 public ActionResult Create(ExpenseBill model)
 {
     model.CreatedBy      = UserID.ToString();
     model.CreatedDate    = DateTime.Now;
     model.OrganizationId = OrganizationId;
     if (ModelState.IsValid)
     {
         ExpenseRepository repo = new ExpenseRepository();
         TempData["success"] = "Saved Successfully. Reference no. is " + repo.Insert(model);
         return(RedirectToAction("Create"));
     }
     else
     {
         FillSupplier();
         FillAddition();
         FillDeduction();
         FillSO();
         FillJC();
         FillCurrency();
         TempData["error"] = "Some error occurred. Please try again.";
         return(View(model));
     }
 }
Beispiel #13
0
        public ActionResult Save(OpeningStock model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();
            //new OpeningStockRepository().DeleteOpeningStock(model);
            //new OpeningStockRepository().InsertOpeningStock(model);
            //new OpeningStockRepository().DeleteStockUpdate(model);
            //new OpeningStockRepository().InsertStockUpdate(model);

            //new OpeningStockRepository().UpdateOpeningStock(model);
            new OpeningStockRepository().SaveOpeningStock(model);
            FillStockpoint();
            FillItem();
            FillPartNo();

            TempData["Success"] = "Added Successfully!";
            OpeningStock OpeningStock = new OpeningStock();

            OpeningStock.OpeningStockItem = new List <OpeningStockItem>();
            OpeningStock.OpeningStockItem.Add(new OpeningStockItem());
            return(RedirectToAction("Index"));
        }
Beispiel #14
0
        public ActionResult Create(Client model)
        {
            if (!ModelState.IsValid)
            {
                FillDropdowns();
                var allErrors = ModelState.Values.SelectMany(v => v.Errors);
                return(View(model));
            }
            model.CreatedBy      = UserID.ToString();
            model.CreatedDate    = System.DateTime.Now;
            model.OrganizationId = OrganizationId;

            Result res = new CustomerRepository().Insert(model);

            if (res.Value)
            {
                TempData["success"] = "Saved Successfully!";
            }
            else
            {
            }
            return(RedirectToAction("Create"));
        }
Beispiel #15
0
        public void PaymentRemindersms(MembersPaymentDetailsModel model)
        {
            if (model.pkiMemberID > 0)
            {
                //Member New Registration Welcome SMS Send
                int SmsGrupId = Convert.ToInt32(SmsGroupType.Payment);
                smsSendingGroupModel modelSSG = client.GetsmsGroupbyID(SmsGrupId, ParlourId);
                if (modelSSG != null)
                {
                    StringBuilder   strsb          = new StringBuilder();
                    smsTempletModel _EmailTemplate = client.GetEmailTemplateByID(SmsGrupId, ParlourId);
                    if (_EmailTemplate != null)
                    {
                        MembersModel objMemberModel = client.GetMemberByID(model.pkiMemberID, ParlourId);

                        strsb = new StringBuilder(_EmailTemplate.smsText);
                        strsb = strsb.Replace("@Name", "<p>" + objMemberModel.FullNames + " " + objMemberModel.Surname + "</p>");
                        strsb = strsb.Replace("@DatePayment", "<p>" + model.PaymentDate + "</p>");
                        strsb = strsb.Replace("@NextDatePayment", "<p>" + model.Notes + "</p>");
                        strsb = strsb.Replace("@Paymentby", "<p>" + model.MethodOfPayment + "</p>");
                        string CellNo = (objMemberModel.Cellphone == string.Empty ? "0" : objMemberModel.Cellphone);
                        if (CellNo == "0")
                        {
                            CellNo = (objMemberModel.Telephone == string.Empty ? "0" : objMemberModel.Telephone);
                        }

                        SendReminderModel smsModel = new SendReminderModel();
                        smsModel.MemeberID       = UserID.ToString();
                        smsModel.MemberData      = strsb.ToString();
                        smsModel.MemeberToNumber = Convert.ToInt64(CellNo.Replace(" ", ""));
                        smsModel.parlourid       = ParlourId;

                        int SendOpration = client.InsertSendReminder(smsModel);
                    }
                }
            }
        }
Beispiel #16
0
        public ActionResult Edit(Item model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();
            var repo = new ItemRepository();


            bool isexists = repo.IsFieldExistsWithActive(repo.ConnectionString(), "Item", "ItemName", model.ItemName, "ItemId", model.ItemId);

            if (!isexists)
            {
                var result = new ItemRepository().UpdateItem(model);

                if (result.ItemId > 0)
                {
                    TempData["Success"] = "Updated Successfully! (" + result.ItemRefNo + ")";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    FillUnit();
                    TempData["error"] = "Some error occurred. Please try again.";
                    return(View("Edit", model));
                }
            }
            else
            {
                FillItem();
                FillJobCardTaskMaster();
                FillUnit();
                TempData["error"] = "This material/spare name already exists!";

                return(View("Edit", model));
            }
        }
        public ActionResult Detail(int id = 0)
        {
            if (id > 0)
            {
                Paging   page  = InitPage();
                _ZhaoPin model = ZhaoPinBLL.Instance.GetZhaoPinDetail(id, UserID, page);
                if (model == null)
                {
                    return(RedirectToAction("Index"));
                }

                ViewBag.canSeeContact = UserInfo != null && (model.Publisher == UserID.ToString() || FeeHRBLL.Instance.IsPayContact(UserID, id, 1));

                //List<JobComment> comments = JobCommentBLL.Instance.GetJobComments(id, 1, page);
                //ViewBag.Comments = comments;
                //ViewBag.CommentPage = page;
                //分页获取评论
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Beispiel #18
0
 public ActionResult Create(Consumption model)
 {
     try
     {
         model.OrganizationId = OrganizationId;
         model.CreatedDate    = DateTime.Now;
         model.CreatedBy      = UserID.ToString();
         string id = new ConsumptionRepository().InsertConsumption(model);
         if (id.Split('|')[0] != "0")
         {
             TempData["success"] = "Saved successfully. Consumption Reference No. is " + id.Split('|')[1];
             TempData["error"]   = "";
             return(RedirectToAction("Create"));
         }
         else
         {
             throw new Exception();
         }
     }
     catch (SqlException sx)
     {
         TempData["error"] = "Some error occured while connecting to database. Please check your network connection and try again.|" + sx.Message;
     }
     catch (NullReferenceException nx)
     {
         TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message;
     }
     catch (Exception ex)
     {
         TempData["error"] = "Some error occured. Please try again.|" + ex.Message;
     }
     TempData["success"] = "";
     JobCardDropdown();
     ItemDropdown();
     return(View(model));
 }
        public async void SendMessage()
        {
            ChatMessage msg = new ChatMessage
            {
                ChatID       = CurrentChat.Id,
                Name         = this.Name,
                FirstUserId  = WriteManId,
                SecondUserId = UserID.ToString(),
                Message      = WriteMessage,
                DateTime     = DateTime.Now
            };



            await _connectionManager.ConnectionHub();

            await _connectionManager.SendMessage(msg);


            await _connectionManager.DisplayMessage = DisplayMessageInChat;
            var result = await _connectionManager.SendMessage(msg);

            DisplayMessage(result);
        }
        public ActionResult Details(ProjectCompletion model)
        {
            try
            {
                model.CreatedBy = UserID.ToString(); model.CreatedDate = DateTime.Today; model.OrganizationId = OrganizationId;
                if (model.ItemBatches != null && model.ItemBatches.Count > 0)
                {
                    foreach (ItemBatch item in model.ItemBatches)
                    {
                        item.WarrantyStartDate  = model.ProjectCompletionDate;
                        item.WarrantyExpireDate = model.ProjectCompletionDate.AddMonths(item.WarrantyPeriodInMonths ?? 0).AddDays(-1);
                    }
                }

                new ProjectCompletionRepository().UpdateProjectCompletion(model);
                TempData["success"] = "Updated Successfully (" + model.ProjectCompletionRefNo + ")";
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                TempData["error"] = "Some error occurred. Please try again.";
            }
            return(View(model));
        }
        public ActionResult Edit(SalesTarget model)
        {
            var repo = new SalesTargetRepository();

            model.CreatedBy = UserID.ToString();
            model.FyId      = new FinancialYearRepository().getfinyear(OrganizationId);
            dropdown();
            model.CreatedDate = System.DateTime.Now;
            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "SalesTarget", "SalesTargetRefNo", model.SalesTargetRefNo, "SalesTargetId", model.SalesTargetId);

            if (!isexists)
            {
                var result = new SalesTargetRepository().UpdateSalesTarget(model);

                if (result.OrganizationId > 0)
                {
                    TempData["Success"]          = "Updated Successfully!";
                    TempData["SalesTargetRefNo"] = result.SalesTargetRefNo;
                    return(RedirectToAction("Create"));
                }
                else
                {
                    dropdown();
                    TempData["error"]            = "Oops!!..Something Went Wrong!!";
                    TempData["SalesTargetRefNo"] = null;
                    return(View("Edit", model));
                }
            }
            else
            {
                dropdown();
                TempData["error"]            = "This Sales Target Ref No. Alredy Exists!!";
                TempData["SalesTargetRefNo"] = null;
                return(View("Create", model));
            }
        }
        public ActionResult Edit(JobCardQC model)
        {
            FillEmployee();

            try
            {
                model.CreatedBy = UserID.ToString(); model.CreatedDate = DateTime.Today; model.OrganizationId = OrganizationId;

                if (model.JobCardQCParams != null && model.JobCardQCParams.Count > 0)
                {
                    new JobCardQCParamRepository().DeleteJobCardQCParam(model.JobCardQCId);
                }

                new JobCardQCRepository().UpdateJobCardQC(model);

                TempData["success"] = "Updated Successfully (" + model.JobCardQCRefNo + ")";
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                TempData["error"] = "Some error occurred. Please try again.";
            }
            return(View(model));
        }
Beispiel #23
0
        public ActionResult Create(ProformaInvoice model)
        {
            try
            {
                model.OrganizationId = OrganizationId;
                model.CreatedDate    = System.DateTime.Now;
                model.CreatedBy      = UserID.ToString();
                string id = new ProformaInvoiceRepository().InsertProformaInvoice(model);
                if (id.Split('|')[0] != "0")
                {
                    TempData["success"] = "Saved successfully. Proforma Invoice No. is " + id.Split('|')[1];
                    //TempData["error"] = "";
                    return(RedirectToAction("PendingProforma", new { ProjectBased = model.isProjectBased }));
                }
                else
                {
                    throw new Exception();
                }
            }
            catch (SqlException sx)
            {
                TempData["error"] = "Some error occured while connecting to database. Please check your network connection and try again.|" + sx.Message;
            }
            catch (NullReferenceException nx)
            {
                TempData["error"] = "Some required data was missing. Please try again.|" + nx.Message;
            }
            catch (Exception ex)
            {
                TempData["error"] = "Some error occured. Please try again.|" + ex.Message;
            }
            TempData["success"] = "";


            return(View(model));
        }
Beispiel #24
0
        public ActionResult AuditMessage()
        {
            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("taskid", Request["taskid"] ?? "0");
            dict.Add("userid", UserID.ToString());
            if ((Request["messagetype"] ?? "1") == "0")
            {
                if ((Request["state"] ?? "0") == "1")
                {
                    DataSet ds = BaseDataProxy.GetDataSet(dict, "sms..audit_SMS_Pass");
                }
                else if ((Request["state"] ?? "0") == "2")
                {
                    DataSet ds = BaseDataProxy.GetDataSet(dict, "audit_SMS_Del");
                }
            }
            else
            {
                dict.Add("state", Request["state"]);
                DataSet ds = BaseDataProxy.GetDataSet(dict, "sms..[audit_Send_And_Notice_v2]");
            }
            return(null);
        }
 public ActionResult CreateRequest(CustomerReceipt model, int Code = 0)
 {
     FillSaleOrder(Code);
     FillJobCard(Code);
     FillSalesInvoice(Code);
     //FillSO();
     //FillJC();
     //FillSI();
     model.OrganizationId = OrganizationId;
     model.CreatedDate    = System.DateTime.Now;
     model.CreatedBy      = UserID.ToString();
     if (new CustomerReceiptRepository().InsertCustomerReceipt(model) > 0)
     {
         TempData["success"] = "Saved successfully";
         TempData["error"]   = "";
         return(RedirectToAction("CreateRequest"));
     }
     else
     {
         TempData["success"] = "";
         TempData["error"]   = "Some error occured. Please try again.";
         return(View("Create", model));
     }
 }
Beispiel #26
0
 public ActionResult PurchaseIndent(DirectPurchaseRequest model)
 {
     try
     {
         model.CreatedBy      = UserID.ToString();
         model.OrganizationId = OrganizationId;
         model.CreatedDate    = DateTime.Today;
         string ref_no = new DirectPurchaseRepository().InsertPurchaseIndent(model);
         if (ref_no.Length > 0)
         {
             TempData["success"] = "Saved Successfully. Reference No. is " + model.PurchaseRequestNo;
             return(RedirectToAction("PurchaseIndent"));
         }
         else
         {
             throw new Exception();
         }
     }
     catch (Exception)
     {
         TempData["error"] = "Some error occurred while saving. Please try again.";
         return(View(model));
     }
 }
Beispiel #27
0
        public ActionResult CreateProject(SalesQuotation model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();

            SalesQuotation result = new SalesQuotationRepository().InsertProjectQuotation(model);

            if (result.SalesQuotationId > 0)
            {
                TempData["Success"] = "Saved Successfully. Reference No. is " + model.QuotationRefNo;
                return(RedirectToAction("CreateProject"));
            }
            else
            {
                TempData["error"] = "Some error occurred. Please try again.";
                DropDowns();
                FillWrkDescForProject();
                FillVehicle();
                FillQuerySheet();
                FillUnit();
                return(View("Create", model));
            }
        }
        public ActionResult Edit(AdditionOrDeduction model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();


            var  repo     = new AdditionOrDeductionRepository();
            bool isexists = repo.IsFieldExists(repo.ConnectionString(), "AdditionDeduction", "AddDedName", model.AddDedName, "AddDedId", model.AddDedId);

            if (!isexists)
            {
                var result = new AdditionOrDeductionRepository().Update(model);
                if (result.AddDedId > 0)
                {
                    TempData["Success"]     = "Updated Successfully!";
                    TempData["AddDedRefNo"] = result.AddDedRefNo;
                    return(RedirectToAction("Create"));
                }

                else
                {
                    FillAdditionDeduction();
                    TempData["error"]       = "Oops!!..Something Went Wrong!!";
                    TempData["AddDedRefNo"] = null;
                    return(View("Create", model));
                }
            }
            else
            {
                FillAdditionDeduction();
                TempData["error"]       = "This Name Alredy Exists!!";
                TempData["AddDedRefNo"] = null;
                return(View("Create", model));
            }
        }
        public string writeTimeStr  = string.Empty;  //创建时间

        protected void Page_Load(object sender, EventArgs e)
        {
            string sheetID = string.Empty;

            if (!IsPostBack)
            {
                if (!String.IsNullOrEmpty(Request.QueryString["sheetID"]))
                {
                    sheetID = Request.QueryString["sheetID"].ToString();
                }
                hf_sheetID.Value  = sheetID;
                hf_mainID.Value   = MainID.ToString();
                hf_sendID.Value   = UserID.ToString();
                hf_sendTime.Value = DateTime.Now.ToString();
                //获取当前工单
                SheetBL   shBLL = new SheetBL();
                DataTable dt    = new DataTable();
                dt = shBLL.GetAPPSheetBYID(long.Parse(sheetID));

                sheetIDStr    = sheetID;
                sheetTypeStr  = dt.Rows[0]["TypeName"].ToString();
                sheetStateStr = dt.Rows[0]["SheetStateCN"].ToString();

                writerNameStr = dt.Rows[0]["WriterName"].ToString();
                writeTimeStr  = dt.Rows[0]["WriteTime"].ToString();



                //获取回复列表
                SheetBL bl = new SheetBL();

                string replyStr = string.Empty;
                if (String.IsNullOrEmpty(Request.QueryString["chatID"]))
                {
                    replyStr = bl.GetAPPSheetChatListBYChatID(0, long.Parse(sheetID));
                }
                else
                {
                    string chatIDStr = Request.QueryString["chatID"];
                    replyStr = bl.GetAPPSheetChatListBYChatID(long.Parse(chatIDStr), long.Parse(sheetID));
                }


                List <Dictionary <string, object> > json = new List <Dictionary <string, object> >();
                JavaScriptSerializer js = new JavaScriptSerializer();
                js.MaxJsonLength = int.MaxValue;
                json             = js.Deserialize <List <Dictionary <string, object> > >(replyStr);
                //if (json.Count < 1)
                //{
                //    //显示已全部加载
                //    string js_loading = "<script language=javascript>dd.ready(function () {dd.device.notification.toast({ text: '已全部加载...' }); });</script>";
                //    HttpContext.Current.Response.Write(js_loading);
                //}
                //else
                //{
                hf_chatID.Value   = json[json.Count - 1]["ID"].ToString(); //保存charID最小值,刷新用
                hf_userName.Value = UserName;                              //当前用户名字                                                 //for(int i=0;i<json.Count;i++)
                for (int i = json.Count - 1; i > -1; i--)
                {
                    //HF.Cloud.BLL.Common.Logger.Error("---" + i);
                    //BLL.Common.Logger.Error("回复类型:" + json[i]["MessageType"].ToString());
                    string userName   = json[i]["UserName"].ToString();
                    string sendTime   = json[i]["SendTime"].ToString();
                    string sendDetail = json[i]["SendDetail"].ToString();
                    if (json[i]["MessageType"].ToString() == "Character")    //如果是文字的话
                    {
                        if (userName == UserName)
                        {
                            //htmlStr.Append("<div style='background-color:#CCFFFF'>" + userName + " - " + sendTime + "</div>");
                            //htmlStr.Append("<div>" + sendDetail + "</div>");
                            //htmlStr.Append("<div>---</div>");

                            htmlStr.Append("<div class=\"SheetReply_bigDIV\">");
                            htmlStr.Append("<div class=\"SheetReply_replyTitle\">");
                            htmlStr.Append("<div class=\"SheetReply_imgDIV_right\">");
                            htmlStr.Append("<img src=\"../img/z.png\"/>");
                            htmlStr.Append("</div>");
                            htmlStr.Append("<div class=\"SheetReply_nameDIV_right\">");
                            htmlStr.Append("<P>" + userName + "</P>");
                            htmlStr.Append("<P class=\"SheetReply_timeDIV\">" + sendTime + "</P>");
                            htmlStr.Append("</div>");
                            htmlStr.Append("</div>");
                            htmlStr.Append("<div class=\"SheetReply_replyDIV_right\">");
                            htmlStr.Append("<p>" + sendDetail + "</p>");
                            htmlStr.Append("</div>");
                            htmlStr.Append("</div>");
                        }
                        else
                        {
                            //htmlStr.Append("<div>" + userName + " - " + sendTime + "</div>");
                            //htmlStr.Append("<div>" + sendDetail + "</div>");
                            //htmlStr.Append("<div>---</div>");
                            htmlStr.Append("<div class=\"SheetReply_bigDIV\">");
                            htmlStr.Append("<div class=\"SheetReply_replyTitle\">");
                            htmlStr.Append("<div class=\"SheetReply_imgDIV\">");
                            htmlStr.Append("<img src=\"../img/z.png\"/>");
                            htmlStr.Append("</div>");
                            htmlStr.Append("<div class=\"SheetReply_nameDIV\">");
                            htmlStr.Append("<P>" + userName + "</P>");
                            htmlStr.Append("<P class=\"SheetReply_timeDIV\">" + sendTime + "</P>");
                            htmlStr.Append("</div>");
                            htmlStr.Append("</div>");
                            htmlStr.Append("<div class=\"SheetReply_replyDIV\">");
                            htmlStr.Append("<p>" + sendDetail + "</p>");
                            htmlStr.Append("</div>");
                            htmlStr.Append("</div>");
                        }
                    }
                    if (json[i]["MessageType"].ToString() == "PIC")    //如果是图片
                    {
                        if (userName == UserName)
                        {
                            htmlStr.Append("<div style='background-color:#CCFFFF'>" + userName + " - " + sendTime + "</div>");
                            htmlStr.Append("<div>" + sendDetail + "</div>");
                            htmlStr.Append("<div>---</div>");
                        }
                        else
                        {
                            htmlStr.Append("<div>" + userName + " - " + sendTime + "</div>");
                            htmlStr.Append("<div>" + sendDetail + "</div>");
                            htmlStr.Append("<div>---</div>");
                        }
                    }
                }
                //}
            }
        }
Beispiel #30
0
        /// <summary>
        /// Property access, initially provided for TokenReplace
        /// </summary>
        /// <param name="propertyName">Name of the Property</param>
        /// <param name="format">format string</param>
        /// <param name="formatProvider">format provider for numbers, dates, currencies</param>
        /// <param name="accessingUser">userinfo of the user, who queries the data (used to determine permissions)</param>
        /// <param name="currentScope">requested maximum access level, might be restricted due to user level</param>
        /// <param name="propertyNotFound">out: flag, if property could be retrieved.</param>
        /// <returns>current value of the property for this userinfo object</returns>
        public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope currentScope, ref bool propertyNotFound)
        {
            Scope internScope;

            if (UserID == -1 && currentScope > Scope.Configuration)
            {
                internScope = Scope.Configuration; //anonymous users only get access to displayname
            }
            else if (UserID != accessingUser.UserID && !isAdminUser(ref accessingUser) && currentScope > Scope.DefaultSettings)
            {
                internScope = Scope.DefaultSettings; //registerd users can access username and userID as well
            }
            else
            {
                internScope = currentScope; //admins and user himself can access all data
            }
            string outputFormat = format == string.Empty ? "g" : format;

            switch (propertyName.ToLowerInvariant())
            {
            case "verificationcode":
                if (internScope < Scope.SystemMessages)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                var ps   = PortalSecurity.Instance;
                var code = ps.Encrypt(Config.GetDecryptionkey(), PortalID + "-" + GetMembershipUserId());
                return(code.Replace("+", ".").Replace("/", "-").Replace("=", "_"));

            case "affiliateid":
                if (internScope < Scope.SystemMessages)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(AffiliateID.ToString(outputFormat, formatProvider));

            case "displayname":
                if (internScope < Scope.Configuration)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(PropertyAccess.FormatString(DisplayName, format));

            case "email":
                if (internScope < Scope.DefaultSettings)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(PropertyAccess.FormatString(Email, format));

            case "firstname":     //using profile property is recommended!
                if (internScope < Scope.DefaultSettings)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(PropertyAccess.FormatString(FirstName, format));

            case "issuperuser":
                if (internScope < Scope.Debug)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(IsSuperUser.ToString(formatProvider));

            case "lastname":     //using profile property is recommended!
                if (internScope < Scope.DefaultSettings)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(PropertyAccess.FormatString(LastName, format));

            case "portalid":
                if (internScope < Scope.Configuration)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(PortalID.ToString(outputFormat, formatProvider));

            case "userid":
                if (internScope < Scope.DefaultSettings)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(UserID.ToString(outputFormat, formatProvider));

            case "username":
                if (internScope < Scope.DefaultSettings)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(PropertyAccess.FormatString(Username, format));

            case "fullname":     //fullname is obsolete, it will return DisplayName
                if (internScope < Scope.Configuration)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(PropertyAccess.FormatString(DisplayName, format));

            case "roles":
                if (currentScope < Scope.SystemMessages)
                {
                    propertyNotFound = true;
                    return(PropertyAccess.ContentLocked);
                }
                return(PropertyAccess.FormatString(string.Join(", ", Roles), format));
            }
            propertyNotFound = true;
            return(string.Empty);
        }