Ejemplo n.º 1
0
        public ActionResult Adddepartdomain()
        {
            Cms_Problemdescription cms_getdepart = new Cms_Problemdescription();

            cms_getdepart.Departmentname = DepartmentList();
            return(View(cms_getdepart));
        }
Ejemplo n.º 2
0
        public bool AddDepartmentwithdescription(Cms_Problemdescription cms_problemdescription)
        {
            string departmentid, departmentdescription, regdate;

            try
            {
                con.Open();
                SqlTransaction trans = con.BeginTransaction();

                try
                {
                    departmentid          = Convert.ToString(cms_problemdescription.Cms_Departmentid);
                    departmentdescription = cms_problemdescription.Cms_Problemdomain;
                    regdate = cms_problemdescription.Cms_Problemregistertime.ToString();
                    SqlCommand dbcmd = con.CreateCommand();
                    dbcmd.Transaction = trans;
                    dbcmd.CommandText = "insert into Cms_Problemdescription(Cms_Departmentid,Cms_Problemdomain,Cms_Problemregistertime) Values(@departmentid,@departmentdescription,@regdate)";
                    dbcmd.Parameters.AddWithValue("@departmentid", departmentid);
                    dbcmd.Parameters.AddWithValue("@departmentdescription", departmentdescription);
                    dbcmd.Parameters.AddWithValue("@regdate", regdate);
                    dbcmd.ExecuteNonQuery();
                    trans.Commit();
                    con.Close();
                    return(true);
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    con.Close();
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        public ActionResult Adddepartdomain(Cms_Problemdescription cmsproblemdescription)
        {
            if (ModelState.IsValid)
            {
                cmsproblemdescription.Cms_Problemregistertime = Convert.ToDateTime(DateTime.Now.ToLongTimeString());

                cmsproblemdescription.Departmentname = DepartmentList();
                var selectedItem = cmsproblemdescription.Departmentname.Find(p => p.Value == cmsproblemdescription.Cms_Departmentid.ToString());
                if (selectedItem != null)
                {
                    selectedItem.Selected = true;
                    qh.AddDepartmentwithdescription(cmsproblemdescription);
                    ViewBag.Success = "Successfully Added!! ";
                }
            }


            if (ViewBag.Success == null)
            {
                ViewBag.Error = "Something went wrong";
            }

            return(View(cmsproblemdescription));
        }