public int AddFormItem(FormItem element) { string sql = "insert into TF_FormItem (ItemName, ItemValue, ItemType, Flag) values ('" + element.ItemName + "', '" + element.ItemValue + "', '" + element.ItemType + "', " + element.Flag + "); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddTaskInfo(TaskInfo element) { string sql = "insert into TaskInfo (EntityId, FlowID, Sponsor, Remark) values (" + element.EntityId + ", " + element.Flow.ID + ", '" + element.Sponsor + "', '" + element.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { Flow flow = FlowLogic.GetInstance().GetFlow(element.Flow.ID); if (flow != null) { FlowTemplate temp = FlowTemplateLogic.GetInstance().GetFlowTemplate(flow.Template.ID); if (temp != null) { Alert alert = new Alert(); alert.提醒对象 = string.Join(",", temp.Stages[flow.CurrentIndex].Executors.ToArray()); alert.提醒方式 = 提醒方式.执行流程; alert.提醒时间 = DateTime.Now; alert.提醒项目 = flow.Name; alert.备注 = flow.ID.ToString(); AlertLogic.GetInstance().AddAlert(alert); Alert alert2 = new Alert(); alert2.提醒对象 = string.Join(",", temp.Stages[flow.CurrentIndex].Approvers.ToArray()); alert2.提醒方式 = 提醒方式.审批流程; alert2.提醒时间 = DateTime.Now; alert2.提醒项目 = flow.Name; alert.备注 = flow.ID.ToString(); AlertLogic.GetInstance().AddAlert(alert2); return(R); } } } return(0); }
public int AddFormObject(FormObject element) { string s = ""; if (element.Owner != null) { s = element.Owner.ID.ToString(); } else { s = "0"; } string sql = "insert into TF_FormObject (FormName, FormType, FormItems, Owner, Remark) values ('" + element.FormName + "', " + element.FormType.ID + ", '" + FormItemLogic.GetItemString(element.FormItems) + "', " + s + ", '" + element.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddStaffCondition(StaffCondition element) { string sql = "insert into TF_StaffCondition (状态, 是否在职, 备注) values ('" + element.状态 + "', " + (element.是否在职 ? "1" : "0") + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddTaskStage(TaskStage element) { string sql = "insert into TaskStage (Name, TaskStatus, TemplateID, Remark) values ('" + element.Name + "', " + (int)element.Status + ", " + element.Template.ID + ", '" + element.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddWorkplan(Workplan element) { string sql = "insert into TF_Workplan (销售, 日期, 带人数, 号码数, 成单数, 回访数, 备注) values (" + element.销售.ID + ", '" + element.日期 + "', " + element.带人数 + ", " + element.号码数 + ", " + element.成单数 + ", " + element.回访数 + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddPersonalTrain(PersonalTrain element) { string sql = "insert into TF_PersonalTrain (MemberID, 私教项目, 次数, 开始日期, 结束日期, 教练, 备注) values (" + element.Member.ID + ", '" + element.私教项目 + "', " + element.次数 + ", '" + element.开始日期 + "', '" + element.结束日期 + "', " + element.教练.ID + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddAction(Action action) { string sql = "insert into TF_Action (Name, FormName, ControlName, Remark) values ('" + action.Name + "', '" + action.FormName + "', '" + action.ControlName + "', '" + action.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddAttachment(Attachment attach) { string sql = "insert into TF_Attachment (AttachmentFilename, Size, Uploader) values ('" + attach.AttachmentFilename + "', " + attach.Size + ", " + attach.Uploader.ID + "); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddFinance(Finance element) { string sql = "insert into TF_Finance (项目, 金额, 是否进账, 余款, 日期, 经手人, 接收人, Detail) values ('" + element.项目 + "', " + element.金额 + ", " + (element.是否进账 ? "1" : "0") + ", " + element.余款 + ", '" + element.日期 + "', '" + element.经手人 + "', '" + element.接收人 + "', '" + element.Detail + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddFollowup(Followup element) { string sql = "insert into TF_Followup (MemberID, 跟进方式, 跟进结果, 跟进时间, 备注, 跟进人) values (" + element.Member.ID + ", " + element.回访方式.ID + ", " + element.跟进结果.ID + ", '" + element.跟进时间 + "', '" + element.备注 + "', " + element.跟进人.ID + "); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddUserGroup(UserGroup ug) { string sql = "insert into TF_UserGroup (Name, Remark) values ('" + ug.Name + "', '" + ug.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddRole(Role role) { string sql = "insert into TF_Role (Name, Permissions, Flag, Remark) values ('" + role.Name + "', '" + Common.GetPermissionsStr(role.Permissions) + "', " + (role.Flag ? "1" : "0") + ", '" + role.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddFlowTemplate(FlowTemplate element) { string sql = "insert into FlowTemplate (Name, Stages) values ('" + element.Name + "', '" + element.StageIds + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddFlow(Flow element) { string sql = "insert into Flow (Name, TemplateID, CurrentIndex, Stages, Remark) values ('" + element.Name + "', " + element.Template.ID + ", " + element.CurrentIndex + ", '" + element.StageIds + "', '" + element.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddProduct(Product element) { string sql = "insert into TF_Product (品名, 种类, 单位, 进价, 售价, 厂家, 姓名, 电话, 地址, 备注) values ('" + element.品名 + "', " + element.种类.ID + ", '" + element.单位 + "', " + element.进价 + ", " + element.售价 + ", '" + element.厂家 + "', '" + element.姓名 + "', '" + element.电话 + "', '" + element.地址 + "', '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddAlert(Alert element) { string sql = "insert into TF_Alert (提醒项目, 提醒时间, 提醒方式, 提醒对象, Flag, 备注) values ('" + element.提醒项目 + "', '" + element.提醒时间 + "', " + (int)element.提醒方式 + ", '" + element.提醒对象 + "', " + element.Flag + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddDairy(Dairy element) { string sql = "insert into TF_Dairy (Pos机会籍, Pos机私教, 现金会籍, 现金私教, 微信会籍, 微信私教, 现金存水, 微信存水, 水吧余, 总金额, 备注, 经手人, 日期) values (" + element.Pos机会籍 + ", " + element.Pos机私教 + ", " + element.现金会籍 + ", " + element.现金私教 + ", " + element.微信会籍 + ", " + element.微信私教 + ", " + element.现金存水 + ", " + element.微信存水 + ", " + element.水吧余 + ", " + element.总金额 + ", '" + element.备注 + "', " + element.经手人.ID + ", '" + element.日期 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddPermission(Permission perm) { string sql = "insert into TF_Permission (Name, TheModule, TheAction, Remark) values ('" + perm.Name + "'," + perm.TheModule.ID + ", " + perm.TheAction.ID + ", '" + perm.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddRenew(Renew element) { string sql = "insert into TF_Renew (MemberID, 卡种, 卡号, 续卡时间, 备注, 经手人) values (" + element.Member.ID + ", " + element.卡种.ID + ", '" + element.卡号 + "', '" + element.续卡时间 + "', '" + element.备注 + "', " + element.经手人.ID + "); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddUser(User user) { string sql = "insert into TF_User (Username, Password, Depart, Flag, Roles, Usergroup, Remark) values ('" + user.Username + "','" + user.Password + "','" + Common.GetDepartmentsStr(user.Departments) + "'," + user.Flag + ",'" + Common.GetRolesStr(user.Roles) + "','" + Common.GetUserGroupsStr(user.Usergroups) + "','" + user.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddCardType(CardType element) { string sql = "insert into TF_CardType (卡种, 是否电子芯片, 备注) values ('" + element.卡种 + "', " + (element.是否电子芯片 ? "1" : "0") + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddProperty(Property element) { string sql = "insert into TF_Property (名称, 单位, 用途, 价格, 备注) values ('" + element.称 + "', '" + element.单位 + "', '" + element.用途 + "', " + element.价格 + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddTaskStageTemplate(TaskStageTemplate element) { string sql = "insert into TaskStageTemplate (Name, Executors, Approvers) values ('" + element.Name + "', '" + TaskStage.GetUserIds(element.Executors) + "', '" + TaskStage.GetUserIds(element.Approvers) + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddFinanceDetail(FinanceDetail element) { string sql = "insert into TF_FinanceDetail (项目, 金额, 是否进账, 责任人, 备注, Flag) values ('" + element.项目 + "', " + element.金额 + ", " + (element.是否进账 ? "1" : "0") + ", " + element.责任人.ID + ", '" + element.备注 + "', " + element.Flag + "); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddStaff(Staff element) { string sql = "insert into TF_Staff (Depart, Condition, 姓名, 性别, 生日, 电话, 宿舍, 钥匙数, 工衣数, 工牌数, 是否全部回收, 备注) values (" + element.Depart.ID + ", " + element.Condition.ID + ", '" + element.姓名 + "', " + (int)element.性别 + ", '" + element.生日.ToString("yyyy-MM-dd") + "', '" + element.电话 + "', '" + element.宿舍 + "', " + element.钥匙数 + ", " + element.工衣数 + ", " + element.工牌数 + ", " + (element.是否全部回收 ? "1" : "0") + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddWorklog(Worklog element) { string sql = "insert into TF_Worklog (销售, 日期, 客户, 电话, 是否自访, 是否老会员, 是否电话拜访, 性别, 意向, 住址, 备注) values (" + element.销售.ID + ", '" + element.日期 + "', '" + element.客户 + "', '" + element.电话 + "', " + (element.是否自访 ? "1" : "0") + ", " + (element.是否老会员 ? "1" : "0") + ", " + (element.是否电话拜访 ? "1" : "0") + ", " + (int)element.性别 + ", '" + element.意向 + "', '" + element.住址 + "', '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddFollowupType(FollowupType element) { string sql = "insert into TF_FollowupType (方式, Flag, 备注) values ('" + element.方式 + "', " + (element.Flag ? "1" : "0") + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddFormType(FormType element) { string sql = "insert into TF_FormType (TypeName, Remark) values ('" + element.TypeName + "', '" + element.Remark + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }
public int AddMemberMoney(MemberMoney element) { string sql = "insert into TF_MemberMoney (会员姓名, 会员电话, 账户余额, 备注) values ('" + element.会员姓名 + "', '" + element.会员电话 + "', " + element.账户余额 + ", '" + element.备注 + "'); select SCOPE_IDENTITY()"; object obj = sqlHelper.ExecuteSqlReturn(sql); int R; if (obj != null && obj != DBNull.Value && int.TryParse(obj.ToString(), out R)) { return(R); } else { return(0); } }