public string UpdExpenseTypeRecord(string id, string etguid, string expensetype, string expenseflag, string saleflag, string manageflag, string financeflag, string otherFlag, string taxflag) { bool result = false; string msg = string.Empty; T_ExpenseType form = new T_ExpenseType(); form.ET_GUID = etguid; form.ExpenseType = expensetype; form.ExpenseFlag = expenseflag; form.SaleFlag = saleflag; form.ManageFlag = manageflag; form.FinanceFlag = financeflag; form.OtherFlag = otherFlag; form.TaxFlag = taxflag; result = new DetailSvc().UpdExpenseTypeRecord(form, id); if (result) { return("success"); } else { msg = General.Resource.Common.Failed; return("failed"); } //return string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}" // , result.ToString().ToLower(), msg); }
public bool UpdExpenseTypeRecord(T_ExpenseType form, string id) { DBHelper db = new DBHelper(); db.strCmd = "SP_UpdExpenseTypeRecord"; db.AddPare("@C_GUID", SqlDbType.NVarChar, 40, id); db.AddPare("@ET_GUID", SqlDbType.NVarChar, 40, form.ET_GUID); db.AddPare("@ExpenseType", SqlDbType.NVarChar, 40, form.ExpenseType); db.AddPare("@ExpenseFlag", SqlDbType.NVarChar, 1, form.ExpenseFlag); db.AddPare("@SaleFlag", SqlDbType.NVarChar, 1, form.SaleFlag); db.AddPare("@ManageFlag", SqlDbType.NVarChar, 1, form.ManageFlag); db.AddPare("@FinanceFlag", SqlDbType.NVarChar, 1, form.FinanceFlag); db.AddPare("@OtherFlag", SqlDbType.NVarChar, 1, form.OtherFlag); db.AddPare("@TaxFlag", SqlDbType.NVarChar, 1, form.TaxFlag); try { db.NonQuery(); return(true); } catch { return(false); } }
public bool AddNewCompany(FormCollection form) { bool result = false; List <T_Company> Info = new List <T_Company>(); Info = new CompanySvc().GetCompanyInfo("", form["CompanyID"]); if (Info.Count.Equals(0)) { //创建 //UpdCompany T_Company company = new T_Company(); company.C_GUID = Guid.NewGuid().ToString(); Session["C_GUID"] = company.C_GUID; company.Name = form["Name"]; company.Taxpayer = form["TaxO"]; company.CompanyID = form["CompanyID"]; string address = form["country"] + "-" + form["province"] + "-" + form["city"]; company.Address = address; company.Country = form["country"]; company.Province = form["province"]; company.City = form["city"]; company.Contacter = ""; company.ContactWay = ""; company.Type = ""; company.AuditDate = DateTime.Today.ToString(); if (new CompanySvc().UpdCompany(company, "", Session["CurrentUserGuid"].ToString())) { AddCompanyCurrency(company.C_GUID, form["Currency"]); AddCompanySetting(company.C_GUID, form["Currency"]); if (Session["CurrentCompanyGuid"].ToString() == "") { Session["CurrentCompanyGuid"] = company.C_GUID; } Session["Currency"] = form["Currency"]; int count = 0; List <T_ExpenseType> List = new List <T_ExpenseType>(); string cid = "66666666-6666-6666-6666-666666666666"; List = new DetailSvc().GetExpenseTypeList(cid, out count); string id = company.C_GUID.ToString(); for (var i = 0; i < List.Count; i++) { string newID = Guid.NewGuid().ToString(); T_ExpenseType form1 = new T_ExpenseType(); form1.ET_GUID = newID; form1.ExpenseType = List[i].ExpenseType; form1.ExpenseFlag = List[i].ExpenseFlag; form1.SaleFlag = List[i].SaleFlag; form1.ManageFlag = List[i].ManageFlag; form1.FinanceFlag = List[i].FinanceFlag; form1.OtherFlag = List[i].OtherFlag; form1.TaxFlag = List[i].TaxFlag; result = new DetailSvc().UpdExpenseTypeRecord(form1, id); } List <T_Tax> ListTax = new List <T_Tax>(); ListTax = new TaxSvc().GetTax(cid); for (var i = 0; i < ListTax.Count; i++) { string newID = Guid.NewGuid().ToString(); T_Tax form2 = new T_Tax(); form2.T_GUID = newID; form2.Name = ListTax[i].Name; form2.Rate = ListTax[i].Rate; form2.Type = ListTax[i].Type; form2.C_GUID = id; new TaxSvc().UpdTax(form2); } //List<T_RateHistory> RateList = new List<T_RateHistory>(); //RateList = new CurrencySvc().GetRateModel(cid,form["Currency"]); //for (var i = 0; i < RateList.Count; i++) //{ // string newID = Guid.NewGuid().ToString(); // T_RateHistory form3 = new T_RateHistory(); // form3.GUID = newID; // form3.FAmount = RateList[i].FAmount; // form3.FCurrency = RateList[i].FCurrency; // form3.TAmount = RateList[i].TAmount; // form3.TCurrency = RateList[i].TCurrency; // form3.CurrentRecord = RateList[i].CurrentRecord; // form3.Currency = RateList[i].Currency; // form3.Rate = RateList[i].Rate; // form3.TRate = RateList[i].TRate; // form3.C_GUID = id; // new CurrencySvc().UpdRateHistory(form3); //} /*添加快速关注模板(新建model以及表)**/ new AccountSvc().UpdIntAccount(cid, id); string Nowtime = GetMinutesDate().ToString(); List <T_QuickAttention> QuickAttenList = new List <T_QuickAttention>(); QuickAttenList = new ReportSvc().GetQuickAttentionModel(cid); for (var i = 0; i < QuickAttenList.Count; i++) { string newID = Guid.NewGuid().ToString(); T_QuickAttention form4 = new T_QuickAttention(); form4.id = newID; form4.c_guid = id; form4.attention_type = QuickAttenList[i].attention_type; form4.attention_type_amount = QuickAttenList[i].attention_type_amount; form4.statistical_time = Convert.ToDateTime(Nowtime); form4.statistical_currency = QuickAttenList[i].statistical_currency; form4.attention_state = QuickAttenList[i].attention_state; form4.push_account = QuickAttenList[i].push_account; form4.push_frequency = QuickAttenList[i].push_frequency; form4.company_name = QuickAttenList[i].company_name; new ReportSvc().UpdQuickAttention(form4); } result = true; } } else { result = false; } return(result); }