Ejemplo n.º 1
0
        public ActionResult CreationPoa(int id)
        {
            string approvername = "chandrika";
            var    a            = _tx_Poa.GetEmployeList(Convert.ToInt32(id));

            var empdatas = _tx_Poa.GetEmployees(Convert.ToInt32(id));

            ViewBag.message = a;


            //var approver = _tx_Poa.GetApproverlist(approvername);
            //ViewBag.app = approver;
            //string ids = "1";
            var c = _tx_Poa.GetEntityList();

            Tx_Poa a1 = new Tx_Poa();
            //id = Convert.ToInt32(a1.token_no);
            SelectList list  = new SelectList("entity_id", "entity_name");
            SelectList list1 = new SelectList("func_id", "func_name");
            SelectList list2 = new SelectList("pow_type_id", "pow_type");
            SelectList list3 = new SelectList("pow_no", "pow_name");
            // ViewData["entity"] = c.AsEnumerable();
            // ViewBag.entity = list;
            //TempData["abc"] = abc;
            // ViewBag.entity = c;
            int abc = id;

            TempData["abc"] = id;
            //var abc2 = TempData["a1"] as string;
            // ViewBag.approver = abc2;

            //return RedirectToAction("CreationPoa", "POA");

            return(RedirectToAction("CreationPoa", "POA"));
            //return  View();

            // return View(a1);
        }
Ejemplo n.º 2
0
        public JsonResult Create(string mydatas)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["entityFramework"].ConnectionString;


            int previousid = int.Parse(TempData["data"].ToString());
            // var previousid = TempData["data"] as string;
            int pre = 0;

            if (previousid == 1)
            {
                previousid = 1;
            }
            else
            {
                //if (previousid ==0)

                previousid = previousid + 1;
            }

            int lastid = 0;

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                string sql = "SELECT max(pow_appr_id) as pow_appr_id FROM TX_POA_Appr";
                using (SqlCommand cmd = new SqlCommand(sql, conn))
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        {
                            while (reader.Read())
                            {
                                lastid = Convert.ToInt32(reader["pow_appr_id"]);
                            }
                        }
                    }
            }

            int Userid = 0;

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var    item = JsonConvert.DeserializeObject <List <Tx_Poa> >(mydatas);
            Tx_Poa poa  = new Tx_Poa();

            for (int i = previousid; i <= lastid; i++)
            {
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();
                    string query = "Insert into TX_POA (approver_id,req_no,request_date, requestor,token_no,pow_appr_id,event_id,create_dt,created_by,mod_dt,mod_by,tx_status) values(@approver_id,@req_no,@request_date, @requestor, @token_no, @pow_appr_id, @event_id, @create_dt, @created_by, @mod_dt, @mod_by, @tx_status)";
                    using (SqlCommand cmd = new SqlCommand(query, conn))
                    {
                        cmd.Parameters.AddWithValue("@request_date", item[0].request_date);
                        cmd.Parameters.AddWithValue("@requestor", item[0].requestor);
                        cmd.Parameters.AddWithValue("@req_no", item[0].req_no);
                        cmd.Parameters.AddWithValue("@token_no", item[0].token_no);
                        cmd.Parameters.AddWithValue("@pow_appr_id", i);
                        cmd.Parameters.AddWithValue("@event_id", item[0].event_id);
                        cmd.Parameters.AddWithValue("@create_dt", DateTime.Now.ToString());
                        //string created_by = "chandrika";
                        cmd.Parameters.AddWithValue("@created_by", item[0].created_by);
                        cmd.Parameters.AddWithValue("@mod_dt", DateTime.Now.ToString());
                        cmd.Parameters.AddWithValue("@mod_by", item[0].mod_by);
                        cmd.Parameters.AddWithValue("@tx_status", item[0].tx_status);
                        cmd.Parameters.AddWithValue("@approver_id", item[0].approver_id);
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            Userid = 1;
            return(Json(Userid, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public ActionResult CreationPoa()
        {
            var    abc1   = TempData["abc"] as int?;
            var    bc     = TempData["a1"] as string;
            Tx_Poa tx_Poa = new Tx_Poa();

            if (abc1 != null)
            {
                var a = _tx_Poa.GetEmployeList(Convert.ToInt32(abc1));
                var b = _tx_Poa.GetEmployees(Convert.ToInt32(abc1));
                var c = _tx_Poa.GetEntityList();
                //var app = _tx_Poa.Getapp();
                // var fun = _tx_Poa.GetFunction();
                var powertype    = _tx_Poa.GetPowerType();
                var power        = _tx_Poa.GetPowers();
                var approverlist = _tx_Poa.GetApproverlist(Convert.ToInt32(abc1));
                if (b == 1)
                {
                    ViewBag.holdtokenvalue = abc1;

                    Tx_Poa a1 = new Tx_Poa();
                    ViewBag.message = a;
                    ViewBag.entity  = c;
                    // ViewBag.app = app;
                    // ViewBag.function = fun;
                    ViewBag.Power     = power;
                    ViewBag.powertype = powertype;
                    ViewBag.approvers = approverlist;
                    // ViewBag.data = app;
                    // ViewBag.data = bid;

                    // ViewBag.message = empdata;


                    return(View());
                }
                else
                {
                    var d = _tx_Poa.GetEntityList();
                    ViewBag.entity = d;
                    //var fun1 = _tx_Poa.GetFunction();
                    // ViewBag.function = fun1;
                    var pow = _tx_Poa.GetPowers();
                    ViewBag.power = pow;
                    var powertypes = _tx_Poa.GetPowerType();
                    ViewBag.powertype = powertypes;
                    var approvers = _tx_Poa.GetApproverlist(Convert.ToInt32(abc1));
                    ViewBag.approver = approvers;
                    var empdatas = _tx_Poa.GetEmployees(Convert.ToInt32(abc1));
                    ViewBag.message = empdatas;
                    //var tempdata = _tx_Poa.getvaluesbaseduponid(Convert.ToInt32( abc1));
                    //ViewBag.data = tempdata;
                    //var approver = _tx_Poa.Insert_Approval_Details();
                    if (ViewBag.message == 0)
                    {
                        ViewBag.message = null;
                        ViewBag.alert   = 1;
                    }


                    return(View());
                }
            }
            else
            {
                var d = _tx_Poa.GetEntityList();
                ViewBag.entity = d;
                //var fun1 = _tx_Poa.GetFunction();
                //ViewBag.function = fun1;
                var power = _tx_Poa.GetPowers();
                ViewBag.power = power;
                var powertypes = _tx_Poa.GetPowerType();
                ViewBag.powertype = powertypes;
                var approvers = _tx_Poa.GetApproverlist(Convert.ToInt32(abc1));
                ViewBag.approver = approvers;
                var empdatas = _tx_Poa.GetEmployees(Convert.ToInt32(abc1));
                ViewBag.message = empdatas;
                //var tempdata = _tx_Poa.getvaluesbaseduponid(Convert.ToInt32(abc1));
                //ViewBag.data = tempdata;



                ViewBag.message = null;


                //var approvers = _tx_Poa.GetApproverlist( );
                //ViewBag.powertype = approvers;
                return(View());
            }
        }
Ejemplo n.º 4
0
        //public List<TX_EMPs> getvaluesbaseduponid(int id)
        //{
        //    //int pow_type_id;
        //    List<TX_EMPs> a1 = new List<TX_EMPs>();

        //    var data = db.emps.Where(c => c.token_no == id).ToList();
        //    // = Convert.ToInt32(id);

        //    return data;

        //}

        public int InsertPOA(Tx_Poa id)
        {
            return(1);
        }