public DataRespond InsertDiscount([FromBody] DiscountRespond ds) { DataRespond data = new DataRespond(); try { Discount item = new Discount(); item.eventname = ds.eventname; DateTime stday = DateTime.ParseExact(ds.startday, "dd/MM/yyyy", CultureInfo.InvariantCulture); item.startday = stday; DateTime endday = DateTime.ParseExact(ds.endday, "dd/MM/yyyy", CultureInfo.InvariantCulture); item.endday = endday; item.stt = ds.stt == 0?true:false; item.percents = ds.percent; item.money = ds.money; item.note = ds.note; item.code = RandomString(10); m_idiscountResponsitory.CreateEvent(item); data.data = item.code; data.success = true; } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond CheckCode([FromBody] CodeRespond modelcode) { DataRespond data = new DataRespond(); try { var ds = m_idiscountResponsitory.GetDisCountByCode(modelcode.code); if (ds == null || checkEnable(ds) == false) { data.success = false; data.error = "Mã giảm giá không hợp lệ"; return(data); } else { ds.stt = false; m_idiscountResponsitory.EditDiscount(ds); data.success = true; data.data = ds; } data.success = true; } catch (Exception e) { data.error = e; data.success = false; } return(data); }
public DataRespond insertDangBo(DangBoRequest db) { DataRespond data = new DataRespond(); try { DangBo dangbo = new DangBo(); dangbo.tendb = db.tendb; dangbo.active = db.active == 0 ? true : false; dangbo.tructhuoc = db.tructhuoc; DateTime ngaytl = DateTime.ParseExact(db.ngaythanhlap, "dd/MM/yyyy", CultureInfo.InvariantCulture); dangbo.ngaythanhlap = ngaytl; dangbo.createday = DateTime.Now; data.success = true; m_dangBoResponsitory.insertDangBo(dangbo); } catch (Exception e) { data.success = false; data.data = e; data.message = e.Message; } return(data); }
public DataRespond updateAbroad([FromBody] ABroadRequest aBroadRequest) { DataRespond data = new DataRespond(); try { Toabroad toabroad = m_adToabroadResponsitory.findToabroadById(aBroadRequest.brid); toabroad.noiden = aBroadRequest.noiden; toabroad.lydo = aBroadRequest.lydo; DateTime daytogo = DateTime.ParseExact(aBroadRequest.thoigiandi, "dd/MM/yyyy", CultureInfo.InvariantCulture); toabroad.thoigiandi = daytogo; DateTime daytoreturn = DateTime.ParseExact(aBroadRequest.thoigiantrove, "dd/MM/yyyy", CultureInfo.InvariantCulture); toabroad.thoigiantrove = daytoreturn; data.success = true; data.message = "update success"; m_adToabroadResponsitory.updateToabraod(toabroad); } catch (Exception e) { data.message = e.Message; data.success = false; data.error = e; } return(data); }
public DataRespond insertAbroad([FromBody] ABroadRequest aBroadRequest) { DataRespond data = new DataRespond(); try { Toabroad toabroad = new Toabroad(); toabroad.fileid = aBroadRequest.fileid; toabroad.noiden = aBroadRequest.noiden; toabroad.lydo = aBroadRequest.lydo; DateTime daytogo = DateTime.ParseExact(aBroadRequest.thoigiandi, "dd/MM/yyyy", CultureInfo.InvariantCulture); toabroad.thoigiandi = daytogo; DateTime daytoreturn = DateTime.ParseExact(aBroadRequest.thoigiantrove, "dd/MM/yyyy", CultureInfo.InvariantCulture); toabroad.thoigiantrove = daytoreturn; toabroad.active = true; toabroad.status = true; toabroad.createday = DateTime.Now; data.success = true; m_adToabroadResponsitory.insertToabroad(toabroad); data.message = "insert success"; } catch (Exception e) { data.success = false; data.error = e; data.message = e.Message; } return(data); }
public async Task <DataRespond> insertAsync([FromForm] ProductRequest product) { DataRespond data = new DataRespond(); try { Product p = new Product(); p.nameproduct = product.nameproduct; p.note = product.note; p.price = product.price; p.discount = product.discount; p.activity = product.activity; DateTime cday = DateTime.ParseExact(product.createday, "dd/MM/yyyy", CultureInfo.InvariantCulture); p.createday = cday; p.picture = await m_image.uploadFile(product.picture); p.lineid = product.lineid; p.supplierid = product.supplierid; data.success = true; m_product.insert(p); data.messger = "Insert success"; }catch (Exception e) { data.success = false; data.error = e; data.messger = e.Message; } return(data); }
public async Task <DataRespond> insertFormFileAsync([FromForm] FormFileRequest formFileRequest) { DataRespond data = new DataRespond(); try { FormFile formFile = m_formFileResponsitory.getFormFileById(formFileRequest.formfileid); data.success = true; data.message = "update success"; if (formFileRequest.giaychungnhanboiduong != null) { deleteFile(formFile.giaychungnhanboiduong); formFile.giaychungnhanboiduong = await uploadFile(formFileRequest.giaychungnhanboiduong); m_formFileResponsitory.updateFormFile(formFile); return(data); } if (formFileRequest.bantukiemdiem != null) { deleteFile(formFile.bantukiemdiem); formFile.bantukiemdiem = await uploadFile(formFileRequest.bantukiemdiem); m_formFileResponsitory.updateFormFile(formFile); return(data); } if (formFileRequest.nhanxetnguoihd != null) { deleteFile(formFile.nhanxetnguoihd); formFile.nhanxetnguoihd = await uploadFile(formFileRequest.nhanxetnguoihd); m_formFileResponsitory.updateFormFile(formFile); return(data); } if (formFileRequest.nhanxetchibo != null) { deleteFile(formFile.nhanxetchibo); formFile.nhanxetchibo = await uploadFile(formFileRequest.nhanxetchibo); m_formFileResponsitory.updateFormFile(formFile); return(data); } if (formFileRequest.quydinhketnap != null) { deleteFile(formFile.quydinhketnap); formFile.quydinhketnap = await uploadFile(formFileRequest.quydinhketnap); m_formFileResponsitory.updateFormFile(formFile); return(data); } } catch (Exception e) { data.message = e.Message; data.error = e; data.success = false; } return(data); }
public DataRespond login(Auth auth) { Users user = m_userResponsitory.getUserByEmail(auth.email); DataRespond data = new DataRespond(); if (auth.email == user.email && auth.password == user.password) { data.data = new { toke = BuildToken(user), id = user.userid }; } return(data); }
public async Task <IActionResult> InsertInvoiveAsync([FromForm] InvoiceRequest invoice) { DataRespond data = new DataRespond(); try { Invoices inv = new Invoices(); inv.namecustomer = invoice.namecustomer; inv.gender = invoice.gender; inv.phonenumber = invoice.phonenumber; inv.email = invoice.email; inv.province = invoice.province; inv.district = invoice.district; inv.adress = invoice.adress; inv.adressdelviver = invoice.adressdelviver; inv.timedeliver = invoice.timedeliver; inv.typepay = invoice.typepay; inv.totalmoney = invoice.totalmoney; inv.money = invoice.money; inv.codediscount = invoice.codediscount; inv.usid = invoice.usid; inv.codeinvoice = RandomString(20); inv.status = 0; //don't acvite inv.isread = 0; //don't view inv.createday = DateTime.Now; Invoices newinv = m_invoiceResponcitory.InsetInvoice(inv); foreach (var i in invoice.invoiceproduct) { InvoiceProductRequest invprd = new InvoiceProductRequest(i); InvoiceProduct invoicers = new InvoiceProduct(); invoicers.prid = invprd.prid; invoicers.total = invprd.total; invoicers.ivid = newinv.ivid; m_invoiceResponcitory.InsertInvoiceProduct(invoicers); } var invsocket = m_invoiceResponcitory.GetFirstInvoice(newinv.codeinvoice); await sendInvoidBySocket(invsocket); sendEmail(invoice.email, inv.codeinvoice); data.success = true; data.data = newinv; } catch (Exception e) { data.success = false; data.error = e; } return(Ok(new { data })); }
public dynamic query([FromBody] RqGrafana rq) { DataRespond datarp = new DataRespond(); try { List <dynamic> response = m_campaign153.getStaticCampaign153(rq); return(response); } catch (Exception e) { datarp.error = e; } return(datarp); }
public dynamic query([FromBody] RqGrafana rq) { DataRespond datarp = new DataRespond(); try { List <dynamic> response = m_combohome.getComboHome(rq); return(response); } catch (Exception e) { datarp.error = e; } return(datarp); }
public dynamic query([FromBody] RqGrafana rq) { DataRespond datarp = new DataRespond(); try { List <dynamic> response = m_detail_lapmoi.getNew(rq); return(response); } catch (Exception e) { datarp.error = e; } return(datarp); }
public DataRespond GetAllComplain(int page,int pagesize) { DataRespond data = new DataRespond(); try { data.data = m_complainResponsitory.GetAllComplain(page, pagesize); data.success = true; } catch(Exception e) { data.success = false; data.error = e; } return data; }
public DataRespond insertStudyProcess([FromBody] StudyProcessRequest request) { DataRespond data = new DataRespond(); try { StudyProcess studyProcess = new StudyProcess(); if (request.studyid != -1) { studyProcess = m_adStudyProcessResponsitory.findById(request.studyid); } else { studyProcess.createday = DateTime.Now; studyProcess.accept = false; studyProcess.active = true; } DateTime starttime = DateTime.ParseExact(request.starttime, "dd/MM/yyyy", CultureInfo.InvariantCulture); studyProcess.starttime = starttime; DateTime endtime = DateTime.ParseExact(request.endtime, "dd/MM/yyyy", CultureInfo.InvariantCulture); studyProcess.endtime = endtime; studyProcess.process = request.process; studyProcess.graduationtype = request.graduationtype; studyProcess.degreetype = request.degreetype; studyProcess.fileid = request.fileid; studyProcess.typeofeducation = request.typeofeducation; studyProcess.adress = request.adress; if (request.studyid != -1) { m_adStudyProcessResponsitory.updateStudyProcess(studyProcess); } else { m_adStudyProcessResponsitory.insertStudyProcess(studyProcess); } data.success = true; data.message = "insert success"; } catch (Exception e) { data.success = true; data.message = e.Message; data.error = e; } return(data); }
public DataRespond checkToken(string email, string token) { DataRespond data = new DataRespond(); foreach (KeyValuePair <string, string> item in m_tokens) { if (item.Key == email && item.Value == token) { data.success = true; data.data = m_userResponsitory.GetUserByEmail(email); return(data); } } data.success = false; return(data); }
public DataRespond GetNewProducts() { DataRespond data = new DataRespond(); try { data.data = _iproductResponsitory.GetNewProducts(); data.success = true; } catch (Exception e) { data.success = false; data.data = e; } return(data); }
public DataRespond signout([FromBody] UserSignOut user) { DataRespond data = new DataRespond(); try { m_authService.logout(user.email); data.success = true; } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond GetProvince() { DataRespond data = new DataRespond(); try { data.success = true; data.data = m_provinceResponsitory.getAllProvince(); } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond getDesPrById(int id) { DataRespond data = new DataRespond(); try { data.data = m_describeResponsitory.getDescriptPrById(id); data.success = true; } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond FilterUBySearchBox([FromBody] UserFilter ft) { DataRespond data = new DataRespond(); try { data.data = _iuserResponsitory.FilterBySearchBox(ft.roles, ft.filter); data.success = true; } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond GetInvoicebyId(int id) { DataRespond data = new DataRespond(); try { data.success = true; data.data = m_invoiceResponcitory.GetInvoiceById(id); } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond login(Auth auth) { DataRespond data = new DataRespond(); try { data = m_auth.login(auth); }catch (Exception e) { data.success = false; data.error = e; data.messger = e.Message; } return(data); }
public DataRespond FilterBySearchBox([FromBody] InvoiceFilter inv) { DataRespond data = new DataRespond(); try { data.success = true; data.data = m_invoiceResponcitory.FilterBySearchBox(inv.filterBy); } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond FilterDiscountBySearchBox(DiscountFilter ds) { DataRespond data = new DataRespond(); try { data.success = true; data.data = m_idiscountResponsitory.FilterDiscount(ds.filter); } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond UpdateDiscount([FromBody] Discount ds) { DataRespond data = new DataRespond(); try { m_idiscountResponsitory.EditDiscount(ds); data.success = true; } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond GetAllDiscount(int page, int pagesize) { DataRespond data = new DataRespond(); try { data.data = m_idiscountResponsitory.GetAllDiscount(page, pagesize); data.success = true; } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond GetProvince(string pid) { DataRespond data = new DataRespond(); try { data.success = true; data.data = m_IDistrictResponsitory.getDistrictByprovince(pid); } catch (Exception e) { data.success = false; data.error = e; } return(data); }
public DataRespond delete(int id) { DataRespond data = new DataRespond(); try { data.success = true; m_lineProduct.delete(id); data.messger = "Delete success"; }catch(Exception e) { data.success = false; data.error = e; data.messger = e.Message; } return data; }
public DataRespond logout([FromBody] Users users) { DataRespond data = new DataRespond(); try { data.success = true; } catch (Exception e) { data.error = e; data.message = e.Message; data.success = false; } return(data); }
public DataRespond GetInvoidByActive(int active, int page, int pagesize) { DataRespond data = new DataRespond(); try { data.data = m_invoiceResponcitory.GetNewInvoiceActive(active, page, pagesize); data.success = true; } catch (Exception e) { data.success = false; data.error = e; } return(data); }