public ActionResult Report(int id, string report, string radioOfficer, string dutyOfficer) { owner owner = null; try { owner = DistressReportControllerManager.getgetOwnerForFax(id); ViewBag.report = report; ViewBag.radioOfficer = radioOfficer; ViewBag.dutyOfficer = dutyOfficer; ViewBag.ownerName = owner.owner_name; ViewBag.ownerAddress = owner.owner_address; ViewBag.ownerTele = owner.owner_tele; return(new Rotativa.ViewAsPdf("DistressReportPDF", DistressReportControllerManager.getDistressReport(id)) { FileName = "FAX MESSAGE.pdf" }); } catch (Exception) { return(RedirectToAction("Error", "Home", new { error = "POST/DistressReport/Report" })); } }
public string GenerateRentCode(owner owner) { //kamus string template = "{0}/{1}"; string code = ""; bool success = false; rent_code rc; //algoritma while (!success) { code = string.Format(template, owner.code, RandomString(5)); rc = context.rent_code.Find(code); if (rc == null) { rc = new rent_code { code = code }; CreateRentCode(rc); success = true; } } return(code); }
private void button1_Click(object sender, EventArgs e) { if (txt_user.Text == "" && txt_password.Text == "") { MessageBox.Show("Harap Isi Username Dan Password"); } else { SqlConnection conn = new SqlConnection(ukom.Properties.Resources.conn.ToString()); conn.Open(); String username = txt_user.Text; String Password = txt_password.Text; SqlCommand da = new SqlCommand("select * from [dbo].[user] where namauser ='******' and password='******'", conn); DataTable dt = new DataTable(); SqlDataReader myReader; myReader = da.ExecuteReader(); int count = 0; string role = string.Empty; while (myReader.Read()) { count = count + 1; role = myReader["role"].ToString(); } if (count == 1) { MessageBox.Show("Username Dan Password . . . Benar", "Pesan Konfirmasi", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Hide(); //admin with generated key if (role == "admin") { this.Hide(); admin parse = new admin(username); parse.Show(); } else if (role == "waiter") { this.Hide(); waiter parse = new waiter(username); parse.Show(); } else if (role == "kasir") { this.Hide(); kasir parse = new kasir(username); parse.Show(); } else if (role == "owner") { this.Hide(); owner parse = new owner(username); parse.Show(); } } else { MessageBox.Show("Username Atau Password Tidak Ditemukan"); } } }
public ActionResult Update(ProfileFormStub model) { if (ModelState.IsValid) { owner dbItem = RepoOwner.FindByPk(model.Id); Guid idOwner = (User as CustomPrincipal).IdOwner.Value; dbItem = model.GetProfile(dbItem, idOwner); dbItem.updated_by = (User as CustomPrincipal).Identity.Name; dbItem.updated_time = DateTimeOffset.Now; try { RepoOwner.Save(dbItem); } catch (Exception e) { //model.FillCarModelOptions(RepoCarModel.FindAll()); return(View("")); } //message string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "EditSuccess").ToString(); this.SetMessage("Profil", template); return(RedirectToAction("Update")); } else { owner owner = RepoOwner.FindByPk(model.Id); ViewBag.name = owner.logo; //model.FillCarModelOptions(RepoCarModel.FindAll()); return(View("Update", model)); } }
public ActionResult AssignUser(OwnerUserFormStub model) { //bool isNameExist = RepoOwner.Find().Where(p => p.name == model.Name).Count() > 0; if (ModelState.IsValid) { var checkUniqueness = RepoOwner.CheckUsername(model.Username, model.IdOwner); if (checkUniqueness == false) { ModelState.AddModelError("Username", "Username sudah pernah di assign pada perusahaan ini sebelumnya"); return(View("FormAssign", model)); } owner_user dbItem = new owner_user(); dbItem = model.GetDbObject(dbItem); owner_user savedData = RepoOwner.SaveUser(dbItem); owner ownerData = RepoOwner.FindOwnerByUserName(savedData.username); //message //string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "CreateSuccess").ToString(); this.SetMessage(savedData.username + " berhasil di assign ke " + ownerData.name); return(RedirectToAction("Index")); } else { //var errors = ModelState.Select(x => x.Value.Errors) // .Where(y => y.Count > 0) // .ToList(); return(View("FormAssign", model)); } }
public ProfilePresentationStub(owner dbItem) { this.Id = dbItem.id; this.Logo = dbItem.logo; this.Contact = dbItem.contact; this.Terms = dbItem.terms; }
public void UpdateDbObject(owner dbItem) { dbItem.id = this.Id; dbItem.code = this.Code; dbItem.name = this.Name; dbItem.updated_by = this.UpdatedBy; dbItem.updated_time = this.UpdatedTime; }
public ProfileFormStub(owner dbItem) { Id = dbItem.id; Logo = dbItem.logo; Contact = dbItem.contact; Terms = dbItem.terms; }
public ActionResult Edit(Guid id) { owner owner = RepoOwner.FindByPk(id); OwnerFormStub formStub = new OwnerFormStub(owner); ViewBag.name = owner.name; return(View("Form", formStub)); }
public ActionResult Edit(OwnerFormStub model) { //bool isNameExist = RepoKompetitor.Find().Where(p => p.name == model.Name && p.id != model.Id).Count() > 0; var currentDate = DateTime.Now; model.UpdatedBy = User.Identity.Name; model.UpdatedTime = currentDate; //Entah kenapa validation failed terus klo ga di buat seperti ini ModelState.Remove("CreatedBy"); ModelState.Remove("UpdatedBy"); if (ModelState.IsValid) { owner dbItem = RepoOwner.FindByPk(model.Id); if (dbItem.code != model.Code) { var checkUniqueness = RepoOwner.CheckCodeUniqueness(model.Code); if (checkUniqueness == false) { ModelState.AddModelError("Code", "Code sudah pernah digunakan sebelumnya"); ViewBag.name = dbItem.name; return(View("Form", model)); } } model.UpdateDbObject(dbItem); //Remove this line when User Identity Name is working if (dbItem.created_by == null) { dbItem.created_by = ""; } try { RepoOwner.Save(dbItem); } catch (Exception e) { return(View("Form", model)); } //message string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "CreateSuccess").ToString(); this.SetMessage(model.Name, template); return(RedirectToAction("Index")); } else { var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); owner owner = RepoOwner.FindByPk(model.Id); ViewBag.name = owner.name; return(View("Form", model)); } }
//[MvcSiteMapNode(Title = "Mobil", ParentKey = "Dashboard",Key="IndexCar")] //[SiteMapTitle("Breadcrumb")] public ActionResult Update() { Guid idOwner = (User as CustomPrincipal).IdOwner.Value; // Ngambil nilai idOwner dari session owner owner = RepoOwner.FindByPk(idOwner); // mengambil nilai owner dari repository yang idowner nya bernilai sama ProfileFormStub formStub = new ProfileFormStub(owner); // memasukan data owner dari repository ke formstub ViewBag.name = owner.name; return(View(formStub)); }
public owner GetProfile(owner dbItem, Guid idOwner) { dbItem.id = this.Id; dbItem.logo = this.Logo; dbItem.contact = this.Contact; dbItem.terms = this.Terms; return(dbItem); }
public ViewResult Map() { CustomPrincipal user = User as CustomPrincipal; owner owner = RepoOwner.FindByPk(user.IdOwner.Value); //viewbag ViewBag.Owner = new OwnerPresentationStub(owner); return(View()); }
private void CreateAuthenticationTicket(string username) { //kamus Business.Entities.roles role; List <Business.Entities.Modules> modules; List <Business.Entities.Actions> actions; List <ModuleAction> appModules = new List <ModuleAction>(); string[] roleNames; //algoritma //get module & action roleNames = Roles.GetRolesForUser(username); foreach (string roleName in roleNames) { role = roleRepo.FindByName(roleName); modules = role.ModulesInRoles.Select(m => m.Modules).ToList(); foreach (Business.Entities.Modules module in modules) { actions = module.Actions.ToList(); foreach (Business.Entities.Actions action in actions) { appModules.Add(new ModuleAction { ModuleName = module.ModuleName, ActionName = action.ActionName }); } } } CustomPrincipalSerializeModel serializeModel = new CustomPrincipalSerializeModel(); serializeModel.Modules = appModules; //owner owner owner = RepoOwner.FindOwnerByUserName(username); if (owner != null) { serializeModel.IdOwner = owner.id; serializeModel.OwnerName = owner.name; } JavaScriptSerializer serializer = new JavaScriptSerializer(); string userData = serializer.Serialize(serializeModel); FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket( 1, username, DateTime.Now, DateTime.Now.AddHours(8), false, userData); string encTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); Response.Cookies.Add(faCookie); }
public OwnerFormStub(owner dbItem) : this() { this.Id = dbItem.id; this.Code = dbItem.code; this.Name = dbItem.name; this.CreatedBy = dbItem.created_by; this.CreatedTime = dbItem.created_time; this.UpdatedBy = dbItem.updated_by; this.UpdatedTime = dbItem.updated_time; this.IdCity = (int)dbItem.id_city; }
public IHttpActionResult AddOwner([FromBody] owner own) { if (ModelState.IsValid) { dbContext.owner.Add(own); dbContext.SaveChanges(); return(Ok(own)); } else { return(BadRequest()); } }
public ActionResult view_certs(int id) { IEnumerable <certificate> certs = db_certs.certificates.Where(x => x.ownerID == id); ViewBag.certs = certs; owner owner = db_certs.owners.First(o => o.id == id); department department = db_certs.departments.First(d => d.id == owner.departmentID); ViewBag.owner = owner; ViewBag.sex = owner.sex ? "Male" : "Female"; ViewBag.department = department; return(View()); }
//update method public int updateOwner(int id, owner owner) { try { owner.owner_last_modified_date = DateTime.Now; owner.owner_last_modified_by = HttpContext.Current.User.Identity.Name; return(OwnersService.updateOwnerDB(id, owner)); } catch (Exception) { throw; } }
public owner GetDbObject() { owner dbItem = new owner(); dbItem.id = this.Id; dbItem.code = this.Code; dbItem.name = this.Name; dbItem.created_by = this.CreatedBy; dbItem.created_time = this.CreatedTime; dbItem.updated_by = this.UpdatedBy; dbItem.updated_time = this.UpdatedTime; dbItem.id_city = this.IdCity.Value; return(dbItem); }
public ActionResult CertViewFull(int id) { certificate certificate = db_certs.certificates.First(c => c.id == id); owner owner = db_certs.owners.First(o => o.id == certificate.ownerID); vendor vendor = db_certs.vendors.First(v => v.id == certificate.vendorID); ViewBag.certificate = certificate; ViewBag.owner = owner; ViewBag.vendor = vendor; ViewBag.img1 = @"~/Files/" + certificate.file1_name; ViewBag.img2 = @"~/Files/" + certificate.file2_name; ViewBag.img3 = @"~/Files/" + certificate.file3_name; ViewBag.img4 = @"~/Files/" + certificate.file4_name; return(View()); }
public OwnerPresentationStub(owner dbItem) { this.Id = dbItem.id; this.Code = dbItem.code; this.Name = dbItem.name; this.CreatedBy = dbItem.created_by; this.CreatedTime = dbItem.created_time; this.UpdatedBy = dbItem.updated_by; this.UpdatedTime = dbItem.updated_time; // kota this.CityName = dbItem.city.name; this.Latitude = dbItem.city.latitude; this.Longitude = dbItem.city.longitude; //this.IdCity = dbItem.id_city; }
public ActionResult edit_owner(owner owner) { var own = db_certs.owners.First(d => d.id == owner.id); own.name = owner.name; own.surname = owner.surname; own.secondName = owner.secondName; own.birthDate = owner.birthDate; own.position = owner.position; own.departmentID = owner.departmentID; own.sex = owner.sex; own.email = owner.email; own.IIN = owner.IIN; own.phone_number = owner.phone_number; db_certs.SaveChanges(); return(RedirectToAction(@"view_department/" + owner.departmentID, "Home")); }
//get owner data to Fax Message public owner getOwnerForFaxDB(int distressReportId) { d_detail d_detail = null; vessel_owner_ref vessel_owner_ref = null; owner owner = null; try { d_detail = db.d_detail.Where(d => d.d_detail_id == distressReportId).FirstOrDefault(); vessel_owner_ref = db.vessel_owner_ref.Where(vor => vor.vessel_id == d_detail.vessel_id).FirstOrDefault(); owner = db.owners.Where(o => o.owner_id == vessel_owner_ref.owner_id && o.owner_status == 1).FirstOrDefault(); } catch (Exception) { throw; } return(owner); }
public ActionResult Edit(int id, owner owner) { try { if (ModelState.IsValid) { int status = OwnersControllerManager.updateOwner(id, owner); if (status == 1) { return(RedirectToAction("Index")); } } return(View()); } catch (Exception) { return(RedirectToAction("Error", "Home", new { error = "POST/Owners/Edit/int" })); } }
public void Save(owner dbItem) { if (dbItem.id == Guid.Empty) //create { dbItem.id = Guid.NewGuid(); owner checkUnique = context.owners.Where(x => x.id == dbItem.id).FirstOrDefault(); while (checkUnique != null) { dbItem.id = Guid.NewGuid(); checkUnique = context.owners.Where(x => x.id == dbItem.id).FirstOrDefault(); } context.owners.Add(dbItem); } else //edit { var entry = context.Entry(dbItem); entry.State = EntityState.Modified; } context.SaveChanges(); }
public ActionResult Create(OwnerFormStub model) { var currentDate = DateTime.Now; model.CreatedBy = User.Identity.Name; model.CreatedTime = currentDate; model.UpdatedBy = User.Identity.Name; model.UpdatedTime = currentDate; bool checkUniqueness = RepoOwner.CheckCodeUniqueness(model.Code); if (checkUniqueness == false) { ModelState.AddModelError("Code", "Code sudah pernah digunakan sebelumnya"); } //Entah kenapa validation failed terus klo ga di buat seperti ini ModelState.Remove("CreatedBy"); ModelState.Remove("UpdatedBy"); if (ModelState.IsValid) { owner dbItem = new owner(); dbItem = model.GetDbObject(); RepoOwner.Save(dbItem); //message string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "CreateSuccess").ToString(); this.SetMessage(model.Name, template); return(RedirectToAction("Index")); } else { //var errors = ModelState.Select(x => x.Value.Errors) // .Where(y => y.Count > 0) // .ToList(); return(View("Form", model)); } }
//update method public int updateOwnerDB(int id, owner owner) { int flag = 0; try { var result = db.owners.Where(v => v.owner_id == id).FirstOrDefault(); if (result != null) { db.Entry(result).State = EntityState.Detached; db.Entry(owner).State = EntityState.Modified; db.SaveChanges(); flag = 1; } } catch (Exception) { throw; } return(flag); }
private void button1_Click(object sender, EventArgs e) { if (textBox2.Text == "" || (textBox1.Text == "" && !radioButton3.Checked)) { MessageBox.Show("Поля количество рабочих и ключ должны быть заполнены!"); } else { int x; if (int.TryParse(textBox2.Text, out x)) { owner my_ciphers = new owner(); int n = 3; if (radioButton1.Checked) { n = 1; } if (radioButton2.Checked) { n = 2; } if (radioButton3.Checked) { n = 3; } try { richTextBox2.Text = my_ciphers.decrypt(richTextBox1.Text, n, x, textBox1.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Поле количество рабочих должно быть целым числом!"); } } }
private void dlog() { if (textBox1.Text.ToString().Length == 12) { string id = textBox1.Text.ToString(); string pwd = textBox2.Text.ToString(); dbsc d0 = new dbsc(); d0.OpenConnection(); StringBuilder sb = new StringBuilder(); sb.AppendLine("declare @pwd0 varchar"); sb.AppendFormat("select @pwd0=[pwd] from [Pinfo] where [pdrivingno]='{0}'", id); sb.AppendLine(); sb.AppendLine("if @pwd0 is null"); sb.AppendFormat("select [idcard] from [Pinfo] where [pdrivingno]='{0}'", id); sb.AppendLine(); sb.AppendLine("else"); sb.AppendFormat("select [pwd] from [Pinfo] where [pdrivingno]='{0}'", id); SqlCommand cmd = new SqlCommand(sb.ToString(), d0.Connection); string pwd0 = cmd.ExecuteScalar().ToString(); d0.CloseConnection(); if (pwd.Equals(pwd0) || pwd.Equals(pwd0.Substring(pwd0.Length - 6, 6))) { MessageBox.Show("登录成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); owner o1 = new owner(this.FindForm(), id); o1.Show(); this.Hide(); } else { MessageBox.Show("用户名或密码错误!", "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("账号为12位驾驶证号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); textBox1.Focus(); } }
public IHttpActionResult UpdateOwner(int id, [FromBody] owner own) { if (ModelState.IsValid) { var ownerExists = dbContext.owner.Count(c => c.owner_id == id) > 0; if (ownerExists) { dbContext.Entry(own).State = EntityState.Modified; dbContext.SaveChanges(); return(Ok(own)); } else { return(NotFound()); } } else { return(BadRequest()); } }
public void OwnerModifySubscriptionStates(Jid to, string node, owner.Subscriber[] subscribers, IqCB cb, object cbArgs) { OwnerModifySubscriptionStates(to, null, node, subscribers, cb, cbArgs); }
public void OwnerModifyAffiliations(Jid to, string node, owner.Affiliate[] affiliates, IqHandler cb) { OwnerModifyAffiliations(to, null, node, affiliates, cb); }
public void OwnerModifyAffiliations(Jid to, string node, owner.Affiliate[] affiliates, IqCB cb, object cbArgs) { OwnerModifyAffiliations(to, null, node, affiliates, cb, cbArgs); }
/* Owner modifies a single affiliation <iq type='set' from='[email protected]/elsinore' to='pubsub.shakespeare.lit' id='ent2'> <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> <affiliates node='blogs/princely_musings'/> <affiliate jid='*****@*****.**' affiliation='owner'/> <affiliate jid='*****@*****.**' affiliation='none'/> <affiliate jid='*****@*****.**' affiliation='publisher'/> </affiliates> </pubsub> </iq> */ public void OwnerModifyAffiliations(Jid to, string node, owner.Affiliate[] affiliates) { OwnerModifyAffiliations(to, null, node, affiliates, null, null); }
public void OwnerModifyAffiliations(Jid to, Jid from, string node, owner.Affiliate[] affiliates, IqCB cb) { OwnerModifyAffiliations(to, from, node, affiliates, cb, null); }
public void OwnerModifyAffiliations(Jid to, Jid from, string node, owner.Affiliate[] affiliates, IqCB cb, object cbArgs) { owner.PubSubIq pubsubIq = new owner.PubSubIq(IqType.set, to); if (from != null) pubsubIq.From = from; owner.Affiliates affs = new owner.Affiliates(node); affs.AddAffiliates(affiliates); pubsubIq.PubSub.Affiliates = affs; if (cb == null) m_connection.Send(pubsubIq); else m_connection.IqGrabber.SendIq(pubsubIq, cb, cbArgs); }
/* <iq type='set' from='[email protected]/elsinore' to='pubsub.shakespeare.lit' id='subman3'> <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'> <subscribers node='blogs/princely_musings'> <subscriber jid='*****@*****.**' subscription='none'/> <subscriber jid='*****@*****.**' subscription='subscribed'/> </subscribers> </pubsub> </iq> */ public void OwnerModifySubscriptionStates(Jid to, string node, owner.Subscriber[] subscribers) { OwnerModifySubscriptionStates(to, null, node, subscribers, null, null); }
public void OwnerModifySubscriptionStates(Jid to, Jid from, string node, owner.Subscriber[] subscribers, IqCB cb) { OwnerModifySubscriptionStates(to, from, node, subscribers, cb, null); }
public void OwnerModifySubscriptionStates(Jid to, Jid from, string node, owner.Subscriber[] subscribers, IqCB cb, object cbArgs) { owner.PubSubIq pubsubIq = new owner.PubSubIq(IqType.set, to); if (from != null) pubsubIq.From = from; owner.Subscribers subs = new owner.Subscribers(node); subs.AddSubscribers(subscribers); pubsubIq.PubSub.Subscribers = subs; if (cb == null) m_connection.Send(pubsubIq); else m_connection.IqGrabber.SendIq(pubsubIq, cb, cbArgs); }