public static bool ProjectManageModifyDate(ProjectManage model) { string sql = string.Format(@"update {0} set [ModifyDate]=getdate(),[ModifyBy]=@ModifyBy,PayDate=@PayDate where Id=@Id", TableName); return(DBAccess.ExecuteSqlWithEntity(sql, model)); }
public static bool ModifyProjectManage(ProjectManage model) { string sql = string.Format(@"update {0} set [Name]=@Name,[FullName]=@FullName,[StartTime]=@StartTime,[EndTime]=@EndTime,[RelStartTime]=@RelStartTime,[RelEndTime]=@RelEndTime,[PayWay]=@PayWay,[LastPayDate]=@LastPayDate,[Money]=@Money,[Status]=@Status,[Infos]=@Infos,[CompanyId]=@CompanyId,[ModifyDate]=getdate(),[ModifyBy]=@ModifyBy,[IsDeleted]=@IsDeleted,[CusCompanyId]=@CusCompanyId,[CusMemberId]=@CusMemberId where Id=@Id", TableName); return(DBAccess.ExecuteSqlWithEntity(sql, model)); }
public JsonResult ProjectManageAddModel(ProjectManage model) { ResultInfo info = new ResultInfo(); var flag = false; var user = CookieOperate.AccountCookie; var cusMember = CustomerMemberDBOperate.GetModelById(user.AccountId); model.CusCompanyId = cusMember.CusCompanyId; model.FullName = model.Name; model.EndTime = DateTime.MaxValue; model.CusMemberId = user.AccountId; model.PayWay = ProjectPayWayEnum.UnKnown.ToString(); model.Status = ProjectStatusEnum.NotStart.ToString(); model.CreateBy = user.Mobile; model.CreateDate = DateTime.Now; model.RelStartTime = model.StartTime; model.RelEndTime = model.EndTime; model.LastPayDate = model.EndTime; model.CompanyId = CommonMethod.GetInt(ConfigSetting.eeeYoooId); model.Source = SourceEnum.PC.ToString(); if (model.Id <= 0) { flag = ProjectManageDBOperate.AddProjectManage(model); info.IsSuccess = flag; if (flag) { info.Message = "保存成功"; } } else { flag = ProjectManageDBOperate.ModifyProjectManage(model); info.IsSuccess = flag; if (flag) { info.Message = "保存成功"; } } return(Json(info)); }
private void loadButton_Click(object sender, EventArgs e) { int i = 0; int max = Directory.GetFiles(this.projdir, "*.xml").Length; // MessageBox.Show(Convert.ToString(this.projectList1.Size.Width)); try { while (i < max)//this.projectList1.Size.Height) { if (this.projectList1.Items[i].Selected == true) { MessageBox.Show(this.projectList1.Items[i].Text + " was selected and loaded successfully.", "Test load result"); ProjectManage prmanager1 = new ProjectManage(); prmanager1.Show(); break; } i += 1; } } catch (Exception) { MessageBox.Show("Critical error detected. Program will shut down.", "Warning!"); Application.Exit(); } }
public static bool AddAccount(CustomerCompany company, CustomerMember member, Account account, ProjectManage projectManage, HardWare hardWare, List <PersonSetting> personSettings) { string companySql = string.Format("insert into {0}([CompanyId],[CompanyName],[Name],[City],[Address],[Status],[Infos],[IsDeleted],[CreateDate],[CreateBy],[TeamDesc],[CompanyStatus],[PartInfo]) " + "values(@CompanyId,@CompanyName,@Name,@City,@Address,@Status,@Infos,0,getdate(),@CreateBy,@TeamDesc,@CompanyStatus,@PartInfo);SELECT @@IDENTITY ", CompanyTableName); string memberSql = string.Format("insert into {0}([CompanyId],[CompanyName],[CusCompanyId],[Name],[ImgUrl],[Mobile],[Email],[Infos],[IsDeleted],[CreateDate],[CreateBy]) " + " values(@CompanyId,@CompanyName,@CusCompanyId,@Name,@ImgUrl,@Mobile,@Email,@Infos,0,getdate(),@CreateBy);SELECT @@IDENTITY", MemberTableName); string sql = string.Format("insert into {0}([Mobile],[Email],[Password],[IsDeleted],[CreateDate],[CreateBy],[Role],[AccountName],[AccountId]) values" + "(@Mobile,@Email,@Password,0,getdate(),@CreateBy,@Role,@AccountName,@AccountId);SELECT @@IDENTITY", TableName); string Projectsql = string.Format("insert into {0}([Name],[FullName],[PayWay],[Money],[Status],[Infos],[CompanyId],[CreateDate],[CreateBy],[IsDeleted]," + "[CusMemberId],[CusCompanyId],[Source],[OpereateType],[DevType],[NowStatus],[DevLanguate],[MarketProspect],[Month])" + " values(@Name,@FullName,@PayWay,@Money,@Status,@Infos,@CompanyId,getdate(),@CreateBy,0,@CusMemberId,@CusCompanyId,@Source,@OpereateType,@DevType,@NowStatus,@DevLanguate,@MarketProspect,@Month);SELECT @@IDENTITY", ProjectTableName); string HardWareSql = string.Format("insert into {0}([IsDeleted],[CreateDate],[CreateBy],[WorkGuid],[Infos],[ProjectId]) values(0,getdate(),@CreateBy,@WorkGuid,@Infos,@ProjectId)", HardWareTableName); string PersonSettingSql = string.Format("insert into {0}([IsDeleted],[CreateDate],[CreateBy],[WorkGuid],[Price],[DepartId],[DepartName],[Infos],[Month],[TotalPrice],[Discount],[ProjectId]) values(0,getdate(),@CreateBy,@WorkGuid,@Price,@DepartId,@DepartName,@Infos,@Month,@TotalPrice,@Discount,@ProjectId)", PersonSettingTableName); using (SqlConnection con = new SqlConnection(ConfigSetting.DataConnection)) { con.Open(); var companyId = con.Query <int>(companySql, company).FirstOrDefault(); member.CusCompanyId = companyId; var memberId = con.Query <int>(memberSql, member).FirstOrDefault(); account.AccountId = memberId; var accountId = con.Query <int>(sql, account).FirstOrDefault(); projectManage.CusCompanyId = companyId; projectManage.CusMemberId = memberId; projectManage.CreateBy = account.AccountName; if (personSettings != null && personSettings.Count() > 0) { projectManage.Money = personSettings.Sum(a => a.TotalPrice); } var projectId = con.Query <int>(Projectsql, projectManage).FirstOrDefault(); hardWare.ProjectId = projectId; personSettings.ForEach(a => { a.ProjectId = projectId; }); if (personSettings != null && personSettings.Count() > 0) { con.Execute(PersonSettingSql, personSettings); } return(con.Execute(HardWareSql, hardWare) > 0); } return(true); //string sql = string.Format("insert into {0}([Mobile],[Email],[Password],[IsDeleted],[CreateDate],[CreateBy],[Role],[AccountName]) values(@Mobile,@Email,@Password,0,getdate(),@CreateBy,@Role,@AccountName)", TableName); //return DBAccess.ExecuteSqlWithEntity(sql, model); }
public static bool AddProjectManage(ProjectManage model) { string sql = string.Format("insert into {0}([Name],[FullName],[StartTime],[EndTime],[RelStartTime],[RelEndTime],[PayWay],[LastPayDate],[Money],[Status],[Infos],[CompanyId],[CreateDate],[CreateBy],[IsDeleted],[CusMemberId],[CusCompanyId],[Source]) values(@Name,@FullName,@StartTime,@EndTime,@RelStartTime,@RelEndTime,@PayWay,@LastPayDate,@Money,@Status,@Infos,@CompanyId,getdate(),@CreateBy,0,@CusMemberId,@CusCompanyId,@Source)", TableName); return(DBAccess.ExecuteSqlWithEntity(sql, model)); }